Post

Replies

Boosts

Views

Activity

Reply to 32 byte NSNumber memory leak - how to fix?
Have you asked Gemini or ChatGPT about this case? When it comes to Swift Concurrency, they are quite good at it. Concerning your issue, Gemini reports to me several issues with the following last comment. In summary, the most critical issue is the unreliable view hierarchy traversal using view.superview?.superview. You should refactor the ViewExtractor to reliably pass the host UIView back to the modifier.
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’25
Reply to how to navigate programmatically without navigation link?
Use navigationDestination(isPresented:destination:) and hide the Back button at the destination View? import SwiftUI struct ContentView: View { @State var goToHello = false var body: some View { NavigationStack { Button { goToHello = true } label: { Text("Go to Hello?") } .navigationDestination(isPresented: $goToHello) { HelloView() } } } } #Preview { ContentView() } struct HelloView: View { var body: some View { NavigationStack { VStack { Text("Hello!") } .navigationBarBackButtonHidden() } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’25
Reply to WidgetKit with Data from CoreData
A solution is not to rely on a Data Manager class and its associates but to use UserDefaults so that Widget's getTimeline method will be called when ContentView submits data to it. By this approach, you can update Widget's View. import SwiftUI import WidgetKit struct ContentView: View { var body: some View { VStack { Button { let task0 = TaskItem(id: UUID(), name: "Dish washing", isComplete: false, dueDate: Date.now.addingTimeInterval(86400)) let task1 = TaskItem(id: UUID(), name: "Bed making", isComplete: false, dueDate: Date.now.addingTimeInterval(86400 * 2)) saveTasksToWidget(tasks: [task0, task1]) } label: { Image(systemName: "globe") .imageScale(.large) } .tint(.pink) .buttonStyle(.borderedProminent) } .padding() } private func saveTasksToWidget(tasks: [TaskItem]) { guard let sharedDefaults = UserDefaults(suiteName: "group.abc") else { print("Failed to get shared UserDefaults.") return } do { let encoder = JSONEncoder() let encodedData = try encoder.encode(tasks) sharedDefaults.set(encodedData, forKey: "widgetTasksArray") WidgetCenter.shared.reloadAllTimelines() } catch { print("Error encoding tasks: \(error)") } } } // TaskItem.swift // import Foundation struct TaskItem: Codable, Identifiable { let id: UUID let name: String let isComplete: Bool let dueDate: Date static let previewTasks = [ TaskItem(id: UUID(), name: "Rose", isComplete: false, dueDate: Date.now.addingTimeInterval(86400)), TaskItem(id: UUID(), name: "Chrisanthumum", isComplete: true, dueDate: Date.now.addingTimeInterval(86400 * 2)), TaskItem(id: UUID(), name: "Garden Dahlia", isComplete: false, dueDate: Date.now.addingTimeInterval(86400 * 3)) ] } // CrazyWidget.swift // import WidgetKit import SwiftUI struct SimpleEntry: TimelineEntry { let date: Date let tasks: [TaskItem] } struct Provider: TimelineProvider { let appGroupID = "group.abc" let dataKey = "widgetTasksArray" func placeholder(in context: Context) -> SimpleEntry { SimpleEntry(date: Date(), tasks: TaskItem.previewTasks) } func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) { let currentTasks = loadTasks() let entry = SimpleEntry(date: Date(), tasks: currentTasks) completion(entry) } func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) { let currentTasks = loadTasks() let entry = SimpleEntry(date: Date(), tasks: currentTasks) let nextUpdate = Calendar.current.date(byAdding: .minute, value: 1, to: Date())! let timeline = Timeline(entries: [entry], policy: .after(nextUpdate)) completion(timeline) } private func loadTasks() -> [TaskItem] { var taskItems: [TaskItem] = [] if let sharedDefaults = UserDefaults(suiteName: appGroupID), let savedData = sharedDefaults.data(forKey: dataKey) { do { let decoder = JSONDecoder() taskItems = try decoder.decode([TaskItem].self, from: savedData) } catch { print("Error decoding tasks from App Group: \(error)") taskItems = TaskItem.previewTasks // Fallback on decoding failure } } else { taskItems = TaskItem.previewTasks // Fallback on access failure } return taskItems } } struct CrazyWidgetEntryView : View { var entry: Provider.Entry var body: some View { VStack(alignment: .leading) { Text("Pending Tasks") .font(.headline) .foregroundColor(.blue) Divider() if entry.tasks.isEmpty { Text("All clear! No tasks found.") .font(.caption) .foregroundColor(.secondary) } else { VStack(alignment: .leading, spacing: 4) { ForEach(entry.tasks.prefix(3)) { task in HStack { Image(systemName: task.isComplete ? "checkmark.circle.fill" : "circle") .foregroundColor(task.isComplete ? .green : .orange) Text(task.name) .font(.caption) .strikethrough(task.isComplete) .lineLimit(1) } } } } } .padding() } } struct CrazyWidget: Widget { let kind: String = "RailMe" var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: Provider()) { entry in CrazyWidgetEntryView(entry: entry) } .configurationDisplayName("RailMe GGGGG") .description("View your current tasks saved from the main app.") .supportedFamilies([.systemSmall, .systemMedium]) } } #Preview("Small - Full Data") { CrazyWidgetEntryView(entry: SimpleEntry(date: Date(), tasks: TaskItem.previewTasks)) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’25
Reply to App Store version stuck in Developer Rejected state, blocking IAP submission
Isn't it just the matter of creating a new subscription group with a new set of product identifiers? You should have switched to the manual release as opposed to auto release and then submit a software update when you decided not to release the initial version. You have made the initial group of product identifiers useless, I guess.
Jan ’26
Reply to "In-App Purchases and Subscriptions" missing, WHY????
I'm in the same shoes since the end of the last December. Because my app contains the Japanese localization package, I thought I was not able to have subscription plans due to the holiday season and the Japan MSCA. But an Apple local rep. says that's not the case. I already released the app by reducing features. In the near future, I want to add subscription plans since it currently has no mineralization mechanism whatsoever. At this moment, it seems that I've reached the end of the rope. Seeing the last submission with subscription plans, I don't see anything wrong with the app in question. Also, I have deleted an existing sub group with a new one once or twice with no resolution.
Jan ’26
Reply to Subscription Group Remains as Prepare for Submission
I've consulted the local Apple Contact Us group. They replied last week that 'Prepare for Submission' is indicative of missing information. I already know that since this app submission is about 250th with IAPs. Then he or she said that my subscription plan may not have a screenshot. That's the case, either. They often try to solve an issue with a guess, which leads nowhere.
Jan ’26