Post

Replies

Boosts

Views

Activity

Reply to Request authorization for the notification center crash iOS app on Swift 6
I can attest that AVCaptureDevice.requestAccess suffered from this same problem, i.e. crashing with a thread/queue violation when built under Swift 6. Original code: AVCaptureDevice.requestAccess(for: AVMediaType.video, completionHandler: { granted in if (granted) { DispatchQueue.main.async { [weak self] in // do something } } }) Modified code: Task { let granted = await AVCaptureDevice.requestAccess(for: .video) if (granted) { Task { @MainActor in // do something } } } This code pops a permission dialog for using the camera, and as soon as the Allow button is clicked the app would crash.
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’24
Reply to New 'badge' property of UIBarButtonItem does not work in iOS 26 beta 3 when used in a toolbar
@elemans I agree this is a great new feature, though my observations are a bit different Setting the badge value with .count() or .string() works for me, but I did have some struggles with colors. I believe setting the .badge property to some non-nil value early on in the UIBarButtonItem lifecycle seemed to help. For example, this code in a UIViewControllers viewDidLoad did produce a cyan on black badge with value 123: self.buttonHistory = UIBarButtonItem.init(image: ...) if #available(iOS 26.0, *) { self.buttonHistory.badge = .count(123) self.buttonHistory.badge?.backgroundColor = .black self.buttonHistory.badge?.foregroundColor = .cyan } self.navigationItem.rightBarButtonItem = buttonHistory and I found that as long as the .badge property is initialized early on to a non-nil value, like shown above (even initializing to .none), then I could subsequently change its value, background, and foreground colors. In my case the UIBarButtonItem is in a UINavigationBar not a UIToolbar, not sure if this makes a difference.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’25
Reply to iOS 26 UIBarButtonItems in navigation bar flashing wrong background during push/pop
I've learned that a combination of two things seems to resolve this issue, or at least soften the effects. For dark UINavigationBar and UIToolbar backgrounds set barStyle = .black don't use UINavigationBarAppearance() to set bar colors, just set navigationBar properties colorBarTint, colorBackground, and isTranslucent = false I'm closing FB19660024, though something definitely not right here ... for example setting the navigation bar title font and color requires use of UINavigationBarAppearance() and these display glitches recur.
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’25
Reply to iOS 26, bottom UIToolbar not extending behind safe area to screen edge
These attached screenshots (from the simple Xcode workspace we submitted with FB19664903) show this issue, the first screenshot is from iOS 26 beta 7 (white gap below the red bottom toolbar), the second screenshot is the same code running on iOS 18.6 (red toolbar extends behind safe area). We have an app that uses many of these bottom toolbars and I'd prefer not to have to refactor....I'm surprised this hasn't received more "me toos"
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’25
Reply to Request authorization for the notification center crash iOS app on Swift 6
I can attest that AVCaptureDevice.requestAccess suffered from this same problem, i.e. crashing with a thread/queue violation when built under Swift 6. Original code: AVCaptureDevice.requestAccess(for: AVMediaType.video, completionHandler: { granted in if (granted) { DispatchQueue.main.async { [weak self] in // do something } } }) Modified code: Task { let granted = await AVCaptureDevice.requestAccess(for: .video) if (granted) { Task { @MainActor in // do something } } } This code pops a permission dialog for using the camera, and as soon as the Allow button is clicked the app would crash.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’24
Reply to New 'badge' property of UIBarButtonItem does not work in iOS 26 beta 3 when used in a toolbar
@elemans I agree this is a great new feature, though my observations are a bit different Setting the badge value with .count() or .string() works for me, but I did have some struggles with colors. I believe setting the .badge property to some non-nil value early on in the UIBarButtonItem lifecycle seemed to help. For example, this code in a UIViewControllers viewDidLoad did produce a cyan on black badge with value 123: self.buttonHistory = UIBarButtonItem.init(image: ...) if #available(iOS 26.0, *) { self.buttonHistory.badge = .count(123) self.buttonHistory.badge?.backgroundColor = .black self.buttonHistory.badge?.foregroundColor = .cyan } self.navigationItem.rightBarButtonItem = buttonHistory and I found that as long as the .badge property is initialized early on to a non-nil value, like shown above (even initializing to .none), then I could subsequently change its value, background, and foreground colors. In my case the UIBarButtonItem is in a UINavigationBar not a UIToolbar, not sure if this makes a difference.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to UIKit crash on app built with Xcode 26 but run on iOS 18.X
Thanks Ed, its FB18995026
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to UIKit crash on app built with Xcode 26 but run on iOS 18.X
This is not corrected in Xcode 26 beta 5
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to iOS 26, UISegmentedControl as UIBarButtonItem not respecting selectedSegmentTintColor
I’ve discovered a workaround for this one: By setting: translatesAutoresizingMaskIntoConstraints = false on the UISegmentedControl the selectedSegmentTintColor is now working.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to iOS 26, bottom UIToolbar not extending behind safe area to screen edge
This is NOT corrected in Xcode 26 beta 6 / iOS 26 beta 7
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to UIKit crash on app built with Xcode 26 but run on iOS 18.X
This is corrected on Xcode 26 beta 6 / iOS 26 beta 7, marking FB18995026 closed, thanks!
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to iOS 26 UIBarButtonItems in navigation bar flashing wrong background during push/pop
This is NOT corrected in Xcode 26 beta 6 / iOS 26 beta 7
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to iOS 26 UIBarButtonItems in navigation bar flashing wrong background during push/pop
I've learned that a combination of two things seems to resolve this issue, or at least soften the effects. For dark UINavigationBar and UIToolbar backgrounds set barStyle = .black don't use UINavigationBarAppearance() to set bar colors, just set navigationBar properties colorBarTint, colorBackground, and isTranslucent = false I'm closing FB19660024, though something definitely not right here ... for example setting the navigation bar title font and color requires use of UINavigationBarAppearance() and these display glitches recur.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to iOS 26, bottom UIToolbar not extending behind safe area to screen edge
These attached screenshots (from the simple Xcode workspace we submitted with FB19664903) show this issue, the first screenshot is from iOS 26 beta 7 (white gap below the red bottom toolbar), the second screenshot is the same code running on iOS 18.6 (red toolbar extends behind safe area). We have an app that uses many of these bottom toolbars and I'd prefer not to have to refactor....I'm surprised this hasn't received more "me toos"
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to iOS 26, bottom UIToolbar not extending behind safe area to screen edge
We're working around this by creating a custom UIView for bottom toolbar that contains an embedded UIToolbar. The UIView constrained to superview .bottom, and UIToolbar constrained to UIView safeAreaLayoutGuide.bottom
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25