Explore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.

All subtopics
Posts under UI Frameworks topic

Post

Replies

Boosts

Views

Activity

Animation Help
Hello, I am trying to use matchedGeometryEffect to animate between an item in a list view and the item's detail view. Right now, I am getting an unwanted cross-fade animation as the view transitions. So the list item moves into place as it should with the modifier, but it fades out as its detail version fades in, which I do not want. I do not want any fading at all, just the movement from one component to the other. How do I stop this? Thanks.
2
0
66
1w
UIKit equivalent of SwiftUI .tabRole(.search)?
In SwiftUI, iOS 18+ provides a dedicated Search tab role: Tab(value: .search, role: .search) { Text("This view is intentionally blank") } This displays Search as a separate tab bar item/slot. Is there an official UIKit equivalent for UITabBarController / UITabBarItem? If not, what is Apple’s recommended UIKit approach to achieve the same UX?
Topic: UI Frameworks SubTopic: UIKit
1
0
124
1w
Picker style .menu doesn't handle nil
Here's the code... import SwiftUI enum Side: String { case left case right } struct SideView: View { @State private var name: String = "" @State private var side: Side? = nil var body: some View { NavigationStack { Form { Section { TextField("Name", text: $name) Picker("Side", selection: $side) { Text("Left").tag(Side.left as Side?) Text("Right").tag(Side.right as Side?) } .pickerStyle(.menu) // displays with "Left" selected even though side is nil // .pickerStyle(.inline) // all the other styles work as expected, nothing initially selected // .pickerStyle(.palette) // .pickerStyle(.navigationLink) } } } } } #Preview("SideView") { SideView() } Even though side is nil the .menu style displays with "Left" selected. Try any of the other styles. They all display with nothing initially selected. As they should when side is nil. This seems like a bug and I've submitted feedback. ID: FB21685273 Whether it's a bug or not has anyone worked around this?
Topic: UI Frameworks SubTopic: SwiftUI
1
0
115
1w
State loss and sheets dismiss on backgrounding app
I've been hitting a weird SwiftUI bug with navigation and state loss and I've managed to reproduce in a very tiny sample project. I've submitted a Feedback FB21681608 but thought it was worth posting here incase any SwiftUI experts can see something obviously wrong. The bug With deeper levels of navigation hierarchy SwiftUI will dismiss views when backgrounding the app. Any work around would be appreciated. This happens in a real app where we have to navigate to a settings screen modally and then a complex flow with other sheets. Sample code Happens in the simulator and on device. import SwiftUI struct ContentView: View { @State private var isPresented = false var body: some View { Button("Show first sheet") { isPresented = true } .sheet(isPresented: $isPresented) { SheetView(count: 1) } } } struct SheetView: View { private enum Path: Hashable { case somePath } @State private var isPresented = false var count: Int var body: some View { NavigationStack { VStack { Text("Sheet \(count)") .font(.largeTitle) // To recreate bug show more than 4 sheets and then switch to the app switcher (CTRL-CMD-Shift-H). // All sheets after number 3 dismiss. Button("Show sheet: \(count + 1)") { isPresented = true } } .sheet(isPresented: $isPresented) { SheetView(count: count + 1) } // Comment out the `navigationDestination` below and the sheets don't dismiss when app goes to the background. // Or move this modifier above the .sheet modifier and the sheets don't dismiss. .navigationDestination(for: Path.self) { _ in fatalError() } } } }
Topic: UI Frameworks SubTopic: SwiftUI
1
1
103
1w
Feedback generator was deactivated by its client more times than it was activated
When I use UIScrollView to Browse photos, sometime was crash. Issue Details: App: 美信 (Midea Connect) Problem: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Feedback generator was deactivated by its client more times than it was activated: <_UIZoomEdgeFeedbackGenerator: 0x33527cdc0>' First throw call stack Affected: 4 user out of thousands iOS Version: 18.0.1、26.1、26.2 What Works: All other users has no crash Same iOS version, no issues User Has Tried: The user experienced two crashes after opening the page hundreds of times
Topic: UI Frameworks SubTopic: UIKit
2
0
123
1w
Apple App Site Association (AASA) and Universal Links Issue
Hi Everyone We are seeking inputs regarding an issue we are observing with Apple App Site Association (AASA) and Universal Links in our iOS application. In our iOS Mobile App, we have a LogIn button which when clicked , opens a webv view to open a login page using WebView. The login flow follows the OAuth mechanism to get the token after successful login. But despite having a correctly configured AASA file and associated domains setup, our application does not consistently handle Universal Links and we simply end up getting a blank page.So, after successful login the control never gets passed back the iOS Mobile app and flow gets stuck on the browser only that just displays a blank page. Earlier the same OAuth flow was working fine when we were using the 'com.test.app://oauth2redirect' comnvention. Based on our investigation, we suspect this behavior may be related to the use of in-app browsers or embedded webviews, rather than an issue with our app or server-side configuration. From our research and observations, it appears that this may be a known iOS behavior and platform limitation, where Universal Links do not automatically work within third-party in-app browsers or webviews (for example, those embedded in apps such as social media or other container applications). Looks like the Universal Links are primarily designed to work when links are opened from system-level contexts such as Safari, Mail, Messages, or Notes, under specific conditions. Given this, we wanted to confirm with you: If you have developed a mobile app earlier that uses the (AASA) and Universal Links in iOS application. Join us with a quick call and we can walkthrough what we have done and see if there is anything missing. Thanks Rahul
Topic: UI Frameworks SubTopic: General
1
0
143
1w
UIMainMenuSystem: remove "Paste and Match Style" item from Edit menu
The default app menu on iPadOS 26 includes an Edit menu with items (among others) Cut, Copy, Paste, Paste and Match Style. I want to remove the last one. I tried the following but nothing worked: let configuration = UIMainMenuSystem.Configuration() configuration.textFormattingPreference = .removed UIMainMenuSystem.shared.setBuildConfiguration(configuration) { builder in builder.remove(action: .pasteAndMatchStyle) if let command = builder.menu(for: .edit)?.children.first(where: { ($0 as? UICommand)?.action == #selector(UIResponderStandardEditActions.pasteAndMatchStyle(_:)) }) as? UICommand { command.attributes.insert(.hidden) } }
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
134
1w
UITabGroup child tabs ignoring viewControllerProvider in Sidebar
Hi, I am implementing a sidebar navigation using UITabBarController with the new UITabGroup API on and above iPadOS 18. I’ve encountered an issue where selecting a child UITab within a group does not seem to trigger the child's own viewControllerProvider. Instead, the UITabBarController displays the ViewController associated with the parent UITabGroup. The Issue: In the snippet below, when I tap "Item 2A" or "Item 2B" in the iPad sidebar, the app displays the emptyVC (clear background) defined in the section2Group provider, rather than the teal or cyan ViewControllers defined in the individual child tabs. let item2A = UITab( title: "Item 2A", image: UIImage(systemName: "a.circle"), identifier: "tab.section2.item2a" ) { _ in self.createViewController( title: "Section 2 - Item 2A", color: .systemTeal, description: "Part of Section 2A group" ) } let item2B = UITab( title: "Item 2B", image: UIImage(systemName: "b.circle"), identifier: "tab.section2.item2b" ) { _ in self.createViewController( title: "Section 2 - Item 2B", color: .systemCyan, description: "Part of Section 2B group" ) } item2A.preferredPlacement = .sidebarOnly item2B.preferredPlacement = .sidebarOnly let section2Group = UITabGroup( title: "Section 2", image: UIImage(systemName: "folder.fill"), identifier: "tabgroup.section2", children: [item2A, item2B] ) { _ in // This provider seems to take precedence over children let emptyVC = UIViewController() emptyVC.view.backgroundColor = .clear return emptyVC } section2Group.preferredPlacement = .sidebarOnly tabs.append(section2Group) The Crash: If I attempt to resolve this by removing the viewControllerProvider from the UITabGroup (with the intent that only children should provide views), the application crashes at runtime. The exception indicates that all tabs within the sidebar must have an associated ViewController, suggesting that the UITabGroup requires a provider even if it is intended to act purely as a visual container. Kindly clarify the following: Is it the intended behavior for UITabGroup to override the viewControllerProvider of its children during sidebar selection? Why does the API require the UITabGroup to return a ViewController if the selection target is a child UITab? Is there a specific configuration or delegate method required to allow the UITabBarController to "pass through" the selection to the child tab's provider? I would appreciate any guidance on whether this is an API limitation or if there is a different structural approach recommended for grouped sidebar items.
1
0
80
1w
TipKit: showing a popover tip on a SwiftUI toolbar button
Hi folks, there's currently a known issue in TipKit due to which it won't show popover tips on buttons that are inside a SwiftUI ToolbarItem. For example, if you try this code, the popover tip will not appear: ToolbarItem { Button(action: {...}) { Label("Tap here", systemImage: "gear") } .popoverTip(sampleTip) } There's an easy workaround for this issue. Just apply a style to the button. It can be any style. Some examples are bordered, borderless, plain and borderedProminent. Here's a fixed version of the above code: ToolbarItem { Button(action: {...}) { Label("Tap here", systemImage: "gear") } .buttonStyle(.plain) // Adding this line fixes the issue. .popoverTip(sampleTip) } Hope this helps anyone running into this issue.
10
10
5.8k
1w
Custom @Observable RandomAcccessCollection List/ForEach issues
I'm trying to understand the behavior I'm seeing here. In the following example, I have a custom @Observable class that adopts RandomAccessCollection and am attempting to populate a List with it. If I use an inner collection property of the instance (even computed as this shows), the top view identifies additions to the list. However, if I just use the list as a collection in its own right, it detects when a change is made, but not that the change increased the length of the list. If you add text that has capital letters you'll see them get sorted correctly, but the lower list retains its prior count. The choice of a List initializer with the model versus an inner ForEach doesn't change the outcome, btw. If I cast that type as an Array(), effectively copying its contents, it works fine which leads me to believe there is some additional Array protocol conformance that I'm missing, but that would be unfortunate since I'm not sure how I would have known that. Any ideas what's going on here? The new type can be used with for-in scenarios fine and compiles great with List/ForEach, but has this issue. I'd like the type to not require extra nonsense to be used like an array here. import SwiftUI fileprivate struct _VExpObservable6: View { @Binding var model: ExpModel @State private var text: String = "" var body: some View { NavigationStack { VStack(spacing: 20) { Spacer() .frame(height: 40) HStack { TextField("Item", text: $text) .textFieldStyle(.roundedBorder) .textContentType(.none) .textCase(.none) Button("Add Item") { guard !text.isEmpty else { return } model.addItem(text) text = "" print("updated model #2 using \(Array(model.indices)):") for s in model { print("- \(s)") } } } InnerView(model: model) OuterView(model: model) } .listStyle(.plain) .padding() } } } // - displays the model data using an inner property expressed as // a collection. fileprivate struct InnerView: View { let model: ExpModel var body: some View { VStack { Text("Model Inner Collection:") .font(.title3) List { ForEach(model.sorted, id: \.self) { item in Text("- \(item)") } } .border(.darkGray) } } } // - displays the model using the model _as the collection_ fileprivate struct OuterView: View { let model: ExpModel var body: some View { VStack { Text("Model as Collection:") .font(.title3) // - the List/ForEach collections do not appear to work // by default using the @Observable model (RandomAccessCollection) // itself, unless it is cast as an Array here. List { // ForEach(Array(model), id: \.self) { item in ForEach(model, id: \.self) { item in Text("- \(item)") } } .border(.darkGray) } } } #Preview { @Previewable @State var model = ExpModel() _VExpObservable6(model: $model) } @Observable fileprivate final class ExpModel: RandomAccessCollection { typealias Element = String var startIndex: Int { 0 } var endIndex: Int { sorted.count } init() { _listData = ["apple", "yellow", "about"] } subscript(_ position: Int) -> String { sortedData()[position] } var sorted: [String] { sortedData() } func addItem(_ item: String) { _listData.append(item) _sorted = nil } private var _listData: [String] private var _sorted: [String]? private func sortedData() -> [String] { if let ret = _sorted { return ret } let ret = _listData.sorted() _sorted = ret return ret } }
2
0
186
1w
[iOS26]UITableView drag bug
I encountered a bug with drag-and-drop sorting in ios 26. I created a UITableView for dragging and dropping to adjust the order of the list. However, when I set the height of the cells to a custom height, some cells were not displayed during the dragging process. The tools I use are the official version of Xcode16.1 and the ios 26 emulator And I can also reproduce the same problem on the real device. class ViewController: UIViewController { private let tableView: UITableView = { let tableView = UITableView.init(frame: .zero, style: .grouped) tableView.backgroundColor = .clear tableView.estimatedSectionHeaderHeight = 50 tableView.isEditing = true tableView.showsVerticalScrollIndicator = false tableView.allowsSelectionDuringEditing = true return tableView }() var content: [Int] = [] override func viewDidLoad() { super.viewDidLoad() tableView.register(FTWatchGroupPageCell.self, forCellReuseIdentifier: "FTWatchGroupPageCell") tableView.delegate = self tableView.dataSource = self view.addSubview(tableView) for i in 1...100 { content.append(i) } tableView.reloadData() } override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() var frame = view.bounds frame.origin.y = 200 frame.size.height = frame.size.height - 200 tableView.frame = frame } } extension ViewController: UITableViewDelegate, UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return content.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "FTWatchGroupPageCell", for: indexPath) as! FTWatchGroupPageCell cell.label.text = "\(content[indexPath.row])" cell.label.sizeToFit() return cell } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 52.66 } public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 0.01 } public func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { return 0.01 } public func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { return true } public func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle { return .none } public func tableView(_ tableView: UITableView, shouldIndentWhileEditingRowAt indexPath: IndexPath) -> Bool { return false } public func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { return true } public func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { let item = content.remove(at: sourceIndexPath.row) content.insert(item, at: destinationIndexPath.row) tableView.reloadData() } } class FTWatchGroupPageCell: UITableViewCell { private let contentBackView = UIView() let label = UILabel() override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) contentView.isHidden = true addSubview(contentBackView) contentBackView.backgroundColor = .red contentBackView.addSubview(label) label.textColor = .black label.font = .systemFont(ofSize: 14) contentBackView.frame = .init(x: 0, y: 0, width: 200, height: 30) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func layoutSubviews() { super.layoutSubviews() guard let reorderControlClass = NSClassFromString("UITableViewCellReorderControl"), let reorderControl = subviews.first(where: { $0.isKind(of: reorderControlClass) }) else { return } reorderControl.alpha = 0.02 reorderControl.subviews.forEach({ subView in if let imageView = subView as? UIImageView { imageView.image = UIImage() imageView.contentMode = .scaleAspectFit imageView.frame.size = CGSize(width: 20, height: 20) } }) } }
3
1
366
1w
Flutter iOS - EXC_BAD_ACCESS crash on cold start after app was killed, affects ~1-2% of users
Question: How to prevent Flutter app crash on iOS 18 during cold start when iOS traverses view hierarchy before Flutter engine is fully initialized? Help needed: Looking for a way to either delay iOS view hierarchy traversal or ensure Flutter is fully initialized before iOS lifecycle callbacks fire. Problem Summary Our Flutter app crashes on cold start for approximately 1-2% of iOS users. The crash occurs specifically on iOS and only under these exact conditions: When crash happens: User opens app and uses it normally ✅ User minimizes app (goes to background) ✅ User returns to app from background ✅ (works fine) User kills app from app switcher (swipe up to close) User taps app icon to launch again → CRASH ❌ Key observations: Crash is intermittent - app may open on 2nd, 3rd, or 5th attempt 100% reproducible on affected devices by repeating kill→launch cycle ~98% of users have no issues Environment Flutter: 3.38.3 Crash Logs (from Sentry) Crash Type 1: Stack Overflow (most common) OS Version: iOS 18.7.2 (22H124) Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: BUS_NOOP at 0x000000016ad5be90 Application Specific Information: compare:options:range:locale: > Stack overflow in (null) Thread 0 Crashed: 0 CoreFoundation CFStringGetLength 1 CoreFoundation CFStringCompareWithOptionsAndLocale 2 CoreFoundation 3 libsystem_c bsearch 4 CoreFoundation 5 UIKitCore ... 15-99: UIKitCore 0x30e177148 [inlined] // 85+ recursive calls Crash Type 2: Use-After-Free Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: SEGV_NOOP at 0x0500007f14000000 KERN_INVALID_ADDRESS at 0x500007f14000000 Thread 0 Crashed: 0 libobjc.A.dylib objc_retainAutoreleaseReturnValue 1 UIKitCore ... 6 libobjc.A.dylib objcrootDealloc 7 QuartzCore // CALayer operations What We Tried (nothing solved cold start crash) Attempt Result Increased stack size to 64MB (-Wl,-stack_size,0x4000000) ❌ No effect Disabled iOS State Restoration ❌ No effect Added isViewLoaded checks in AppDelegate ❌ No effect Added try-catch around GetStorage/SecureStorage init ❌ No effect Added isAppActive flag to track app state ❌ No effect Snapshot overlay in applicationWillResignActive ✅ Fixed background→foreground crash, ❌ but NOT cold start Current AppDelegate.swift import UIKit import Flutter @main @objc class AppDelegate: FlutterAppDelegate { private var snapshotView: UIView? private var isAppActive = false override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GeneratedPluginRegistrant.register(with: self) window?.overrideUserInterfaceStyle = .light isAppActive = true return super.application(application, didFinishLaunchingWithOptions: launchOptions) } override func application(_ application: UIApplication, shouldSaveSecureApplicationState coder: NSCoder) -> Bool { return false } override func application(_ application: UIApplication, shouldRestoreSecureApplicationState coder: NSCoder) -> Bool { return false } override func applicationWillResignActive(_ application: UIApplication) { guard isAppActive, let window = self.window, let rootVC = window.rootViewController, rootVC.isViewLoaded, snapshotView == nil else { return } let snapshot = UIView(frame: window.bounds) snapshot.backgroundColor = .white snapshot.tag = 999 window.addSubview(snapshot) snapshotView = snapshot } override func applicationDidBecomeActive(_ application: UIApplication) { guard snapshotView != nil else { isAppActive = true return } snapshotView?.removeFromSuperview() snapshotView = nil } }
Topic: UI Frameworks SubTopic: UIKit
2
0
309
2w
macOS Tahoe WKWebView - NSPrintOperation EXC_BREAKPOINT with Lots of Error Logging
Running print operation on WKWebView I hit EXC_BREAKPOINT and there is all kinds of console spew that looks concerning: ERROR: The NSPrintOperation view's frame was not initialized properly before knowsPageRange: returned. (WKPrintingView) ** CGContextClipToRect: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.** WebContent[7743] networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception. CRASHSTRING: XPC_ERROR_CONNECTION_INVALID from launchservicesd CRASHSTRING: rdar://problem/28724618 Process unable to create connection because the sandbox denied the right to lookup com.apple.coreservices.launchservicesd and so this process cannot talk to launchservicesd. WebContent[7921] The sandbox in this process does not allow access to RunningBoard. Safe to ignore all this?
4
0
203
2w
SwiftUI/WKWebView app migrated from React Native to SwiftUI shows blank/blue screen for some users after App Store update
I’m hoping to get some insight from Apple engineers or developers who have seen similar behavior. Background We previously had a React Native / Expo iOS app in production for several years. Recently, we rebuilt the app completely from scratch as a native SwiftUI app using WKWebView (no shared code, no RN runtime). The new app architecture is: Native SwiftUI container WKWebView loading a remote web app Firebase Analytics & Crashlytics Push notifications (APNs + FCM) No local database, no persistent native state Migration scenario Users update the app via the App Store: Old app: React Native / Expo New app: native SwiftUI + WKWebView For most users, the migration works fine. However, for a about 10% of users, the following happens: The issue After updating from the old React Native app to the new SwiftUI app: The app opens The native landing screen appears (solid black OR blue background, depending on which most recent version if being installed) The app never transitions to the WKWebView No crash Force-quitting does not help Deleting the app completely and reinstalling does fix it 9/10 times, but NOT ALWAYS. From the user’s perspective: “The app is stuck on a black OR blue screen forever.” Important detail Most of the times, a full uninstall + reinstall FIXES the issue, but funny enough, NOT always.. In some cases, the issue persists: What we’ve already tried Over the last weeks, multiple iOS developers have investigated this. We have implemented and/or tested: Full rebuild in SwiftUI (no RN remnants) Aggressive cleanup on first launch after update: -- UserDefaults cleanup -- WKWebsiteDataStore cleanup -- URLCache / cookies cleanup Timeouts and fallbacks so the UI never blocks indefinitely Explicit logging of: -- app_open -- session_start -- webview_init -- webview_load_start / finish -- blank screen detection Handling: -- WKWebView content process terminated -- network / TLS / DNS errors Added a native SwiftUI landing screen (in the latest version) so users no longer see a black screen, but now they see a BLUE screen when the transition fails Observations from Analytics & Crashlytics No native crashes Very high user engagement (~99%) Very low blank-screen detection (~1–2%) The issue does not appear to be mass-scale But support still receives complaints daily from affected users This suggests a device / iOS / network-specific edge case, not a general migration failure. Hypotheses (not confirmed) We suspect one of the following, but haven’t been able to prove it: WKWebView failing to initialize under specific conditions after App Store updates TLS / ATS / CDN edge behavior affecting first WKWebView load iOS lifecycle timing issue when transitioning from SwiftUI landing view to WKWebView OS-specific WebKit state that survives reinstall (keychain? system WebKit state?) ISP / DNS / IPv6-related issues on first launch What we’re looking for We would really appreciate insight on: Are there known cases where WKWebView fails silently after an App Store update, even after reinstall? Is there any system-level WebKit state that survives app deletion? Are there best practices for transitioning from a SwiftUI landing view to WKWebView to avoid dead-ends? Any known iOS versions / device classes where this behavior is more common? Any debugging techniques beyond Crashlytics / Analytics that could surface what WebKit is failing on? We’re not looking for generic “clear cache” advice — we’ve already gone far down that path. We’re trying to understand whether this is a known WebKit edge case or something we are fundamentally missing. Thanks in advance for any pointers or shared experiences.
Topic: UI Frameworks SubTopic: SwiftUI
0
0
60
2w
Regarding the deadline for adopting the UIScene life cycle
https://developer.apple.com/forums/thread/788293 In the above thread, I received the following response: "When building with the SDK from the next major release after iOS 26, iPadOS 26, macOS 26 and visionOS 26, UIKit will assert that all apps have adopted UIScene life cycle. Apps that fail this assert will crash on launch." does this mean that there will be no app crashes caused by UIKit in iOS 26, but there is a possibility of app crashes when building with the SDK provided from iOS 27 onwards?
Topic: UI Frameworks SubTopic: UIKit Tags:
3
0
424
2w
How to make a binary XCFramework self-contained with embedded resource bundles
I’m building an iOS SDK that is distributed as a binary XCFramework and consumed via Swift Package Manager using a binaryTarget. What I’ve done so far: Built the SDK using xcodebuild archive for device and simulator Created the XCFramework using xcodebuild -create-xcframework The SDK contains a resource bundle with JSON/config files The XCFramework is wrapped using SPM (code-only wrapper target) Currently, the resource bundle exists outside the XCFramework, and the host app needs to add it manually during integration. I want to avoid this and make the SDK completely self-contained. What I’m trying to achieve: Embed the resource bundle inside the SDK framework so that each XCFramework slice contains it Ensure the SDK can load its assets internally at runtime without any host app changes Questions: What is the correct way to embed a .bundle inside a framework so it gets packaged into each XCFramework slice during archiving? Which Xcode build phases or build settings are required for this (e.g., Copy Bundle Resources, SKIP_INSTALL, etc.)? At runtime, what is the recommended approach for locating and loading this embedded bundle from within the SDK code? Any guidance or best practices for achieving this would be helpful.
0
0
60
2w
How to trigger ShieldConfigurationExtension?
On pressing the secondary button on my ShieldConfigurationExtension, I remove the shields by setting shields in the named ManagedStore to nil in my ShieldActionExtension. // ShieldActionExtension.swift let store = ManagedSettingsStore() store.shield.applications = nil store.shield.applicationCategories = nil Now after some duration I want to re-apply the shields again for which I do the following: // ShieldActionExtension.swift DispatchQueue.main.asyncAfter(deadline: .now() + unlockDuration) { [weak self] in self?.reapplyShields(for: sessionId, application: application) } private func reapplyShields(for sessionId: String, application: ApplicationToken) { store.shield.applications = Set([application]) } Followed by the completionHandler: // ShieldActionExtension.swift completionHandler(.defer) Now the expectation is ShieldConfigurationExtension should be re-triggered with store.shield.applications = Set([application]), however I see the default iOS screen time shield. This behavior is experience when the blocked app is running in the foreground. However, if I close and re-open the blocked app - the ShieldConfigurationExtension is trigerred again correctly. If I do a completionHandler(.none) instead, the overriden configuration method in ShieldConfigurationExtension is not triggered. How do I make sure ShieldConfigurationExtension is triggered if the blocked app is running in the foreground when the shields are re-applied again?
0
0
104
2w
How can I be notified if another app goes full screen on macOS?
Is there any way I can know that another app has gone full screen? Please note that this is not what NSWindowDidEnterFullScreenNotification does, that only works for my own windows. As for why I need to know: Say you're playing a YouTube video full screen. The video fills up the main display, and if there's a second display, it goes black. Well, mostly. I have a utility app with small status windows that remain on top. I'd like to be polite and hide them in this scenario.
1
1
215
2w
SwiftData & CloudKit: Arrays of Codable Structs Causing NSKeyedUnarchiveFromData Error
I have SwiftData models containing arrays of Codable structs that worked fine before adding CloudKit capability. I believe they are the reason I started seeing errors after enabling CloudKit. Example model: @Model final class ProtocolMedication { var times: [SchedulingTime] = [] // SchedulingTime is Codable // other properties... } After enabling CloudKit, I get this error logged to the console: 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release CloudKit Console shows this times data as "plain text" instead of "bplist" format. Other struct/enum properties display correctly (I think) as "bplist" in CloudKit Console. The local SwiftData storage handled these arrays fine - this issue only appeared with CloudKit integration. What's the recommended approach for storing arrays of Codable structs in SwiftData models that sync with CloudKit?
8
1
734
2w