Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Construct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.

UIKit Documentation

Posts under UIKit subtopic

Post

Replies

Boosts

Views

Activity

UserDefaults.standard was cleared and app UUDI is also changed when I update new version from app store
Facing issue of NSUserDefaults data got cleared on update new version from app store. so all data of user got cleared and user have to login again. I was having app in store with version 1.1.3 and then we have uploaded new version to store with version 1.1.4 but when user download app from store their data was cleared from UserDefaults.so this is big issue in update. need to help. is that apple updated any process on update. Question How Apple change version build in device when we update app from app store. is it uninstall old build and install new build ? Or it is install new version on old version ? Should UserDefaults.standard will delete on update ? Updating Provisioning profile from manual to automatically cause issue on UserDefaults.standard Like UserDefaults got cleared and uuid will change ? Do we have anythings that we can identify specific user as uniq user ? What is better solution to store login data into SQLite store or in UserDefaults as model ? Will appreciate for your help. this is very big issue and login again on update will make app user more effect
4
1
3.8k
May ’25
How do I size a UITextView with scroll disabled?
tl;dr: UITextView does not auto layout when isScrollEnabled = false I have a screen with multiple UITextViews on it, contained within a ScrollView. For each textview, I calculate the height needed to display the entire content in SwiftUI and set it using the .frame(width:height:) modifier. The UITextView will respect the size passed in and layout within the container, but since UITextView is embedded within a UIScrollView, when a user attempts to scroll on the page, often they will scroll within a UITextView block rather than the page. They currently need to scroll along the margins outside of the textview to get the proper behavior. Since I am already calculating the height to display the text, I don't want the UITextView to scroll. However, when I set isScrollEnabled = false, the text view displays in a single long line that gets truncated. I have tried Setting various frame/size attributes but that seems to have zero affect on the layout. Embedding the textView within a UIView, and then sizing the container, but then the textView does not display at all. Setting a fixed size textContainer in the layoutManager but did not work. There's a lot of code so I can't copy/paste it all, but generally, it looks like struct SwiftUITextEditor: View { @State var text: AttributedString = "" var body: some View { ZStack { MyTextViewRepresentable(text: $text) } .dynamicallySized(from: $text) } } struct MyTextViewRepresentable: UIViewRepresentable { @Binding var text: AttributedString let textView = UITextView(usingTextLayoutManager: true) func makeUIView(context: Context) -> UITextView { textView.attributedText = text textView.isScrollEnabled = false } ... }
1
0
55
May ’25
New UIButton title left aligned
Hello There, I was trying to do a Button with title left aligned. With the old UIButton, I would have used the title-/contentEdgeInsets to achieve this, but with the new button these values are deprecated and do not work anymore. As far as I understood, with the new button only the spacing between the elements (sub-, title and image) is controllable. I also tried just setting the buttons width to the same width as the label, what would be possible in my case since it should be kind of a "hyperlink-button" which has no background or border. This works so far, but once the user interacts with the button, the title label gets multiline, which is on the one hand not wanted and on the other hand of course does not look left aligned anymore. (Besides the buttons height is fix in my case which leads to clipping of the title) So here again in short: Is there any way to make the title of the new UIButton left aligned inside of the button? Thank you very much in advance.
2
0
1.6k
May ’25
SIGTRAP crash in CoreGraphics font rendering pipeline (iOS 18.4)
We're observing new crashes specifically on iOS 18.4 devices with this pattern: Exception Type: SIGTRAP Exception Codes: fault addr: 0x000000019bc0f088 Crashed Thread: 0 Thread 0 0 libsystem_malloc.dylib _xzm_xzone_malloc_from_tiny_chunk.cold.1 + 36 1 libsystem_malloc.dylib __xzm_xzone_malloc_from_tiny_chunk + 612 2 libsystem_malloc.dylib __xzm_xzone_find_and_malloc_from_tiny_chunk + 112 3 libsystem_malloc.dylib __xzm_xzone_malloc_tiny_outlined + 312 4 CoreGraphics CG::Path::Path(CG::Path const&) + 132 5 CoreGraphics _CGPathCreateMutableCopyByTransformingPath + 112 6 CoreGraphics _CGFontCreateGlyphPath + 144 7 CoreGraphics _CGGlyphBuilderLockBitmaps + 1112 8 CoreGraphics _render_glyphs + 292 9 CoreGraphics _draw_glyph_bitmaps + 1116 10 CoreGraphics _ripc_DrawGlyphs + 1464 11 CoreGraphics CG::DisplayList::executeEntries(std::__1::__wrap_iter<std::__1::shared_ptr<CG::DisplayListEntry const>*>, std::__1::__wrap_iter<std::__1::shared_ptr<CG::DisplayListEntry const>*>, CGContextDelegate*, CGRenderingState*, CGGStack*, CGRect const*, __CFDictionary const*, bool) + 1328 12 CoreGraphics _CGDisplayListDrawInContextDelegate + 340 13 QuartzCore _CABackingStoreUpdate_ + 612 14 QuartzCore ____ZN2CA5Layer8display_Ev_block_invoke + 120 15 QuartzCore -[CALayer _display] + 1512 16 QuartzCore CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 420 17 QuartzCore CA::Context::commit_transaction(CA::Transaction*, double, double*) + 476 18 QuartzCore CA::Transaction::commit() + 644 19 UIKitCore ___34-[UIApplication _firstCommitBlock]_block_invoke_2 + 36 20 CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28 21 CoreFoundation ___CFRunLoopDoBlocks + 352 22 CoreFoundation ___CFRunLoopRun + 868 23 CoreFoundation _CFRunLoopRunSpecific + 572 24 GraphicsServices _GSEventRunModal + 168 25 UIKitCore -[UIApplication _run] + 816 26 UIKitCore _UIApplicationMain + 336 27 app _main + 132 28 dyld __dyld_process_info_create + 33284 Key Observations: Crash occurs during font glyph path creation (CGFontCreateGlyphPath) Involves memory allocation in malloc's xzone implementation 100% reproducible on iOS 18.4, not seen in prior OS versions Occurs during standard CALayer rendering operations Not tied to any specific font family or glyph content Questions for Apple: Is this crash signature recognized as a known issue in iOS 18.4's CoreGraphics? Could changes to xzone memory management in iOS 18.4 interact poorly with font rendering? Are there specific conditions that might trigger SIGTRAP in CGPathCreateMutableCopyByTransformingPath? Any recommended mitigations for text rendering while awaiting system updates?
2
3
369
May ’25
iOS 18.4 Beta: On iPhones which support Dynamic Island, the AppDelegate method applicationDidBecomeActive() takes longer to be called.
When testing with iOS 18.4 Beta on iPhones which support Dynamic Island, after doing a Face ID authentication, the amount of time it takes before the AppDelegate method applicationDidBecomeActive() is called takes longer than iPhones that do not support Dynamic Island. The time it takes is about double, 1.2 seconds vs 2.5 seconds on average. This does not occur with versions before 18.4 Beta. Anyone else seeing this?
Topic: UI Frameworks SubTopic: UIKit
2
3
309
May ’25
UITextView crash on iOS 18.4 beta
UITextView crash when setting attributed text that contains substring ffi and attributedText contains NSFontAttributeName, NSForegroundColorAttributeName Reproducible case: UITextView *textView = [[UITextView alloc] init]; textView.attributedText = [[NSAttributedString alloc] initWithString:@"ffi" attributes:@{ NSParagraphStyleAttributeName: [self createParagraphOfLineHeight:20], NSFontAttributeName: [UIFont systemFontOfSize:fontSize weight:UIFontWeightRegular], NSForegroundColorAttributeName: UIColor.black }];
Topic: UI Frameworks SubTopic: UIKit Tags:
9
2
1.8k
May ’25
When presenting CPNavigationAlert the navigation bar will appear
In my CarPlay app, I am hiding the navigation bar by using the following: self.mapTemplate?.automaticallyHidesNavigationBar = true self.mapTemplate?.hidesButtonsWithNavigationBar = false I don't want the navigation bar to show unless a user interacts with the map by tapping it. Strangely, when I present a CPNavigationAlert the navigation bar will often appear and then disappear after the alert is dismissed. Is there a setting or reason that the navigation bar would be appearing when presenting this alert? I would like to keep the nav bar hidden during this time.
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
33
May ’25
cannot save event
iOS 18.4.1 When I change a Google type event to an iCloud type, a "Cannot Save Event" prompt box pops up. We have also received user feedback that recurring events also fail to save. After updating to iOS 18.4 when trying to save changes to an existing repeating event, the message "Cannot Save Event" will appear. EventKitUI
Topic: UI Frameworks SubTopic: UIKit
0
0
39
May ’25
Behavior of Drawings in Portrait/Landscape Mode
The app provides a simple drawing functionality on a canvas without using a storyboard. After creating drawings in portrait mode, rotating the simulator or the iPad-Device to landscape mode does not update or rescale the existing drawings to fit the newly expanded canvas area. The app can also be launched directly in landscape mode, allowing drawings to be created before rotating the device back to portrait mode. However, the issue persists, with the drawings not adjusting to the new canvas dimensions. The goal is to achieve the same behavior as in the Apple Notes app: when the iPad is rotated, the drawings should adjust to the newly expanded or reduced canvas area. I would appreciate any suggestions or solutions. Sample Projekt [https://github.com/GG88IOS/Test_Drawing_App)
4
0
75
May ’25
Random crash on app language change from app
I've developed an app in swift and UIKit. Its multi linguistic app supports English and Arabic. When I change the language from English to Arabic or Arabic to English. After changing language, when I navigate through different screens crash is happening randomly on different screens most of the time when I tap to navigate to a screen. And cash log is: This time crashed with this error Exception NSException * "Not possible to remove variable:\t945: <unknown var (bug!) with engine as delegate:0x2824edf00>{id: 34210} colIndex:261 from engine <NSISEngine: 0x15c5dd5f0>{ delegate:0x15c594b50\nEngineVars:\n\t 0: objective{id: 31542} rowIndex:0\n\t 1: UIButton:0x15c6255b0.Width{id: 31545} rowIndex:1\n\t 2: 0x281c41450.marker{id: 31548} colIndex:1\n\t 3: UIButton:0x15c6255b0.Height{id: 31547} rowIndex:1073741824\n\t 4: 0x281c412c0.marker{id: 31546} colIndex:1073741825\n\t 5: UIButton:0x15c625a50.Width{id: 31549} rowIndex:11\n\t 6: 0x281c41270.marker{id: 31544} colIndex:2\n\t 7: UIButton:0x15c625a50.Height{id: 31551} rowIndex:1073741825\n\t 8: 0x281c414a0.marker{id: 31550} colIndex:1073741826\n\t 9: UILabel:0x15c625d10.Height{id: 31553} rowIndex:1073741826\n\t 10: 0x281c41590.marker{id: 31552} colIndex:1073741827\n\t 11: UIImageView:0x15c625870.Width{id: 31555} rowIndex:3\n\t 12: 0x281c41360.marker{id: 31554} colIndex:3\n\t 13: UIImageView:0x15c625870.Height{id: 31557} rowIndex:1073741827\n\t 14: 0x281c413b0.marker{id: 31556} colIndex:1073741828"... 0x0000000282fb11a0 For switching language I'm using this code snippet: private func restartApp() { guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, let delegate = windowScene.delegate as? SceneDelegate, let window = delegate.window else { return } // Create a new root view controller let vc : AppLoadingVC = AppRouter.instantiateViewController(storyboard: .Splash) let nc = UINavigationController(rootViewController: vc) ApplicationManager.sharedInstance.isUserLoggedIn = false DispatchQueue.main.async { if UserDefaults.isRTL { UIView.appearance().semanticContentAttribute = .forceRightToLeft SideMenuController.preferences.basic.forceRightToLeft = true Localize.setCurrentLanguage("ar") } else { UIView.appearance().semanticContentAttribute = .forceLeftToRight SideMenuController.preferences.basic.forceRightToLeft = false Localize.setCurrentLanguage("en") } window.rootViewController = nc window.makeKeyAndVisible() } } Please anybody help me I've been stuck here since lot of days. I tried multiple things but all in vain.
1
0
42
Apr ’25
Intents UI Extension automatically dismisses
I am working on implementing a new Intents UI Extension and have noticed that when it is triggered via the "Hey Siri" voice command, the intent dismisses after a few seconds. However, if it is launched from the Shortcuts app, the intent remains active and does not dismiss automatically. Additionally, I’ve observed that this behavior occurs on specific iOS versions, such as 17.5.1 or 17.7. On other versions, like 17.4.1 or 18.4, the intent persists as expected. Does Siri automatically close the intent based on its own logic? Could the iOS version be influencing this behavior? Given the requirement to make the intent persistent, is there any option or configuration available to achieve this?
0
0
31
Apr ’25
App Crashes on Paper Selection After Background Printer Connection
Description: 1. When initiating the print flow via UIPrintInteractionController, and no printer is initially connected, iOS displays all possible paper sizes in the paper selection UI. However, if a printer connects in the background after this view is shown, the list of paper sizes does not automatically refresh to reflect only the options supported by the connected printer. 2. If the user selects an incompatible paper size (one not supported by the printer that has just connected), the app crashes due to an invalid configuration. Steps to Reproduce: Launch the app and navigate to the print functionality. Tap the Print button to invoke UIPrintInteractionController. At this point, no printer is yet connected. iOS displays all available paper sizes. While the paper selection UI is visible, the AirPrint-compatible printer connects in the background. Without dismissing the controller, the user selects a paper size (e.g., one that is not supported by the printer). The app crashes. Expected Result: App should not crash Once the printer becomes available (connected in the background), the paper size options should refresh automatically. The list should be filtered to only include sizes that are compatible with the connected printer. This prevents the user from selecting an invalid option, avoiding crashes. Actual Result: App crashes The paper size list remains unfiltered. The user can still select unsupported paper sizes. Selecting an incompatible option causes the app to crash, due to a mismatch between UI selection and printer capability. Demo App Crash : https://drive.google.com/file/d/19PV02wzOJhc2DYI6kAe-uxHuR1Qg15Bu/view?usp=sharing Apple Files App Crash: https://drive.google.com/file/d/1flHKuU_xaxHSzRun1dYlh8w7nBPJZeRb/view?usp=sharing
0
0
17
Apr ’25
Use Siri to control parts of my CarPlay app
I am building a CarPlay navigation app and I would like it to be as hands free as possible. I need a better understanding of how Siri can work with CarPlay and if the direction I need to go is using Intents or App Shortcuts. My goal is to be able to have the user speak to Siri and do things like "open settings" or "zoom in map" and then call a func in my app to do what the user is asking. Does CarPlay support this? Do I need to use App Intents or App Shortcuts or something else?
2
0
57
Apr ’25
Tab Bar Controller Not Using Safe Area
I have several apps where I successfully implemented Safe Area Margins, but this app uses a Tab Bar Controller and it ignores the safe areas. I am using Xcode 16.2, and Storyboards. The "Use Safe Area Layout Guides" is checked for every scene, yet none are using the safe area. Any clues?
Topic: UI Frameworks SubTopic: UIKit
3
0
28
Apr ’25
Siri Shortcuts of Siri Intent to Voice Control Parts of App
I am new to the idea of Siri Shortcuts and App Intents. What I want to do is use Siri to run a function in my app. Such as saying to Siri Zoom in map and that will then call a function in my app where I can zoom in the map. Similarly, I could say Zoom out map and it would call a function to zoom out my map. I do not need to share any sort of shortcut with the Shortcuts app. Can someone please point me in the right direction for what type of intents I need to use for this?
0
0
32
Apr ’25
How to get UIFont to respect preferredContentSizeCategory in a Mac Catalyst app?
I have an iOS app that relies on dynamic text size such that all fonts in the app respect the user's setting of Text Size in the iOS Settings app. This app also runs on macOS via Mac Catalyst. But until macOS 14 Sonoma, there was no Text Size setting in the macOS Settings app. But even as of Sonoma, the Text Size setting isn't usable by 3rd party apps. And Sequoia doesn't seem to change that. As a work around, my Mac Catalyst app provides its own Text Size setting. I was able to make it work by providing my own UIApplication subclass and overriding preferredContentSizeCategory. Under macOS 12 to macOS 14, this workaround works just fine and all fonts in the app created with code such as UIFont.preferredFont(forTextStyle:) gives appropriately sized fonts based on the overridden content size category. However, this workaround stopped working with macOS 15 Sequoia. I've also tried code such as: self.window.traitOverrides.preferredContentSizeCategory = myCustomSizeCategoryValue and self.window.maximumContentSizeCategory = myCustomSizeCategoryValue self.window.minimumContentSizeCategory = myCustomSizeCategoryValue in the scene delegate but that made no difference. Is there any way to get code such as UIFont.preferredFont(forTextStyle:) to return an appropriately sized font based on some app provided content size category in a Mac Catalyst app running under macOS 15? It sure would be nice if Mac Catalyst apps automatically responded to the macOS Text Size setting under Settings -> Accessibility -> Display -> Text Size just like a native iOS app.
3
1
620
Apr ’25