Post

Replies

Boosts

Views

Activity

Reply to Tab bar controller drag and drop order of items not working
I succeeded moving Xcode 16.4, MacMini, MacOS 15.6 (24G84): Here is the initial tabbar I click on the tabor in the TabBarController it turns blue I click on icon of item 1 and start dragging (I had to take care to hold the mouse pressed). A position caret appears (I cannot screenshot the caret) and icon starts to move and the other to rearrange I move the caret (and the icon) to the desired position) and drop it The icons are reordered If that's OK, don't forget to close the thread on this answer ; otherwise please explain where it fails. As you noticed, there is another way to do it, by creating the segues in desired order.
Aug ’25
Reply to @State variable returns empty despite being set in .onAppear function
Could you provide complete code as well as the json file ? Is Data a structure you have defined ? If it is an empty set, it should crash at: DataView(data: data[index]) Do you get Fail messages ? Problem is not in onAppear. I tested by replacing getData by a dummy call .onAppear { // let filePath = Bundle.main.path(forResource: "data", ofType: "json") // let url = URL(fileURLWithPath: filePath!) // // data = getData(url: url) data = [Data()] } And data DataView is not empty, as I could check with the following struct DataView: View { @State var data: Data var body: some View { Text("DataView \(data)") } } So, it looks like you return from getData by line 29 and not 22. So, could you change line 29, to return a custom single data to check ?
Topic: Design SubTopic: General Tags:
Aug ’25
Reply to Swift 6 conversion for IBOutlet
@eskimo that was when testing with Swift6 and Xcode 16.4. But after encapsulating the code using IBOutlet in MainActor.assumeIsolated({ // using textField.text }) I could remove the nonIsolated declaration for IBOutlet and get it working. Unfortunately, I've not kept a version to reproduce the error. In any case, I will not switch to Swift6 before using Xcode 26.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’25
Reply to Crash in Swift 6 when using UNUserNotification
@Engineer Thanks for reply. Some more crash info. On simulator (did not test on device at this stage). Here is crash report: Error occurs in #4 notifyMe IBAction @IBAction func notifyMe(_ sender: UIButton) { let center = UNUserNotificationCenter.current() center.delegate = self center.getNotificationSettings(completionHandler: { (settings) in if settings.authorizationStatus == .notDetermined { center.requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in DispatchQueue.main.async { if !granted { // Alert user } } } } else if settings.authorizationStatus == .denied { DispatchQueue.main.async { // Alert user } } else if settings.authorizationStatus == .authorized { DispatchQueue.main.async { self.alarmButton.isHidden = self.duree <= 120 } } }) var alertStyle = UIAlertController.Style.alert let alertController = UIAlertController( title: NSLocalizedString("M'avertir", comment: ""), message: NSLocalizedString("Attention", comment: ""), preferredStyle: alertStyle) var title = NSLocalizedString("5'", comment: "") let ok = UIAlertAction(title: title, style: .default, handler: {(action) -> Void in self.sendInitialNotification(beforeEnd: 5) DispatchQueue.main.async { sender.isHidden = true } }) alertController.addAction(ok) let cancelAction = UIAlertAction(title: NSLocalizedString("Non", comment: ""), style: .default, handler: { (action) -> Void in alertController.addAction(cancelAction) present(alertController, animated: true, completion: nil) } Crash apparently occurs on calling userNotificationCenter: nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { if notification.request.identifier == requestIdentifier { completionHandler( [.alert,.sound,.badge]) } }
Aug ’25
Reply to Swift 6 conversion for IBOutlet
Thanks Quinn. I removed the nonisolated for IBOutlet. But, as shown in your example, I had to mark all func în a class that uses UNUserNotificationCenterDelegate as nonIsolated, such as nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) I also note in your example that you marked response for didReceive as async. I tried to, but got the error: Instance method 'userNotificationCenter(_:didReceive:withCompletionHandler:)' nearly matches optional requirement 'userNotificationCenter(_:didReceive:withCompletionHandler:)' of protocol 'UNUserNotificationCenterDelegate' with the advice to Make 'userNotificationCenter_:didReceive:withCompletionHandler:)' private to silence this warning Converting to Swift 6 is definitely not an easy ride… I'll do extensive testing.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’25
Reply to Crash in Swift 6 when using UNUserNotification
Thanks for the answer. didReceive was already non isolated. So problem likely does not come from here. For willPresent, if I don't make it nonIsolated, I get an Xcode 16.4 compiler error: Main actor-isolated instance method 'userNotificationCenter(_:willPresent:withCompletionHandler:)' cannot be used to satisfy nonisolated requirement from protocol 'UNUserNotificationCenterDelegate' n Xcode 26, no error in func declaration if I remove nonIsolated. But error at UIViewController class definition level Conformance of 'CalcViewController' to protocol 'UNUserNotificationCenterDelegate' crosses into main actor-isolated code and can cause data races
Aug ’25
Reply to Swift 6 conversion for IBOutlet
MainActor.assumeIsolated seems the simplest way to go. I have noticed an important point when converting to Swift 6 which may help others. At some point, I had nearly 200 errors… Don't panic they say… Problem was that errors kept coming and disappearing. Just as if the compiler was a bit lost (and me with him) with all the changes occurring on classes or func (such as declaring MainActor or non isolated). This made error correction pretty erratic. I did a Clean build folder, and the number of errors dropped to less than 10.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’25
Reply to @State variable returns empty despite being set in .onAppear function
Thanks. But your code does not compile, with the following errors: Does it compile for you ?
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Tab bar controller drag and drop order of items not working
I succeeded moving Xcode 16.4, MacMini, MacOS 15.6 (24G84): Here is the initial tabbar I click on the tabor in the TabBarController it turns blue I click on icon of item 1 and start dragging (I had to take care to hold the mouse pressed). A position caret appears (I cannot screenshot the caret) and icon starts to move and the other to rearrange I move the caret (and the icon) to the desired position) and drop it The icons are reordered If that's OK, don't forget to close the thread on this answer ; otherwise please explain where it fails. As you noticed, there is another way to do it, by creating the segues in desired order.
Replies
Boosts
Views
Activity
Aug ’25
Reply to @State variable returns empty despite being set in .onAppear function
Could you provide complete code as well as the json file ? Is Data a structure you have defined ? If it is an empty set, it should crash at: DataView(data: data[index]) Do you get Fail messages ? Problem is not in onAppear. I tested by replacing getData by a dummy call .onAppear { // let filePath = Bundle.main.path(forResource: "data", ofType: "json") // let url = URL(fileURLWithPath: filePath!) // // data = getData(url: url) data = [Data()] } And data DataView is not empty, as I could check with the following struct DataView: View { @State var data: Data var body: some View { Text("DataView \(data)") } } So, it looks like you return from getData by line 29 and not 22. So, could you change line 29, to return a custom single data to check ?
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Need option to change searchBar placement
Did you try to set the placement, such as: .searchable(text: $searchText, isPresented: $isSearchPresented, placement: .navigationBarDrawer, prompt: "Search...")
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Hide search field always
Welcome to the forum. Could you show (screenshots) what you get and what you'd expect. And please also post the complete code.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Swift 6 Minimum Requirement for App Store
@Ed Ford, for this useful clarification. So that means there is no urgency to switch to Swift 6 mode, unless of course there are concurrency issues or we need specific Swift 6 feature ? I understand however that it is wise to set concurrency checking at the max level, even in Swift 5 mode. Is it correct ?
Replies
Boosts
Views
Activity
Aug ’25
Reply to Swift 6 conversion for IBOutlet
@eskimo that was when testing with Swift6 and Xcode 16.4. But after encapsulating the code using IBOutlet in MainActor.assumeIsolated({ // using textField.text }) I could remove the nonIsolated declaration for IBOutlet and get it working. Unfortunately, I've not kept a version to reproduce the error. In any case, I will not switch to Swift6 before using Xcode 26.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Stop our app from being used
Logically, users would receive an error message from your app if backend is off. In any case, if you don't update the app for 3 years, it will be removed automatically. May be the best is just to wait ?
Replies
Boosts
Views
Activity
Aug ’25
Reply to Bug in Apple Developer Program License Agreement
No feedback. Closing the thread.
Replies
Boosts
Views
Activity
Aug ’25
Reply to Crash in Swift 6 when using UNUserNotification
@Engineer Thanks for reply. Some more crash info. On simulator (did not test on device at this stage). Here is crash report: Error occurs in #4 notifyMe IBAction @IBAction func notifyMe(_ sender: UIButton) { let center = UNUserNotificationCenter.current() center.delegate = self center.getNotificationSettings(completionHandler: { (settings) in if settings.authorizationStatus == .notDetermined { center.requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in DispatchQueue.main.async { if !granted { // Alert user } } } } else if settings.authorizationStatus == .denied { DispatchQueue.main.async { // Alert user } } else if settings.authorizationStatus == .authorized { DispatchQueue.main.async { self.alarmButton.isHidden = self.duree <= 120 } } }) var alertStyle = UIAlertController.Style.alert let alertController = UIAlertController( title: NSLocalizedString("M'avertir", comment: ""), message: NSLocalizedString("Attention", comment: ""), preferredStyle: alertStyle) var title = NSLocalizedString("5'", comment: "") let ok = UIAlertAction(title: title, style: .default, handler: {(action) -> Void in self.sendInitialNotification(beforeEnd: 5) DispatchQueue.main.async { sender.isHidden = true } }) alertController.addAction(ok) let cancelAction = UIAlertAction(title: NSLocalizedString("Non", comment: ""), style: .default, handler: { (action) -> Void in alertController.addAction(cancelAction) present(alertController, animated: true, completion: nil) } Crash apparently occurs on calling userNotificationCenter: nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { if notification.request.identifier == requestIdentifier { completionHandler( [.alert,.sound,.badge]) } }
Replies
Boosts
Views
Activity
Aug ’25
Reply to Swift 6 conversion for IBOutlet
Thanks Quinn. I removed the nonisolated for IBOutlet. But, as shown in your example, I had to mark all func în a class that uses UNUserNotificationCenterDelegate as nonIsolated, such as nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) I also note in your example that you marked response for didReceive as async. I tried to, but got the error: Instance method 'userNotificationCenter(_:didReceive:withCompletionHandler:)' nearly matches optional requirement 'userNotificationCenter(_:didReceive:withCompletionHandler:)' of protocol 'UNUserNotificationCenterDelegate' with the advice to Make 'userNotificationCenter_:didReceive:withCompletionHandler:)' private to silence this warning Converting to Swift 6 is definitely not an easy ride… I'll do extensive testing.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Crash in Swift 6 when using UNUserNotification
Thanks for the answer. didReceive was already non isolated. So problem likely does not come from here. For willPresent, if I don't make it nonIsolated, I get an Xcode 16.4 compiler error: Main actor-isolated instance method 'userNotificationCenter(_:willPresent:withCompletionHandler:)' cannot be used to satisfy nonisolated requirement from protocol 'UNUserNotificationCenterDelegate' n Xcode 26, no error in func declaration if I remove nonIsolated. But error at UIViewController class definition level Conformance of 'CalcViewController' to protocol 'UNUserNotificationCenterDelegate' crosses into main actor-isolated code and can cause data races
Replies
Boosts
Views
Activity
Aug ’25
Reply to In Xcode 26 ß (iOS 26 simulator) UIBarButtonItem content disappear when tapped
Improved with Beta 4 and 5. Now, the text does not disappear when button is tapped, but is dimmed (like in disabled state). So I think it is the final version of UI.
Replies
Boosts
Views
Activity
Aug ’25
Reply to Swift 6 conversion for IBOutlet
MainActor.assumeIsolated seems the simplest way to go. I have noticed an important point when converting to Swift 6 which may help others. At some point, I had nearly 200 errors… Don't panic they say… Problem was that errors kept coming and disappearing. Just as if the compiler was a bit lost (and me with him) with all the changes occurring on classes or func (such as declaring MainActor or non isolated). This made error correction pretty erratic. I did a Clean build folder, and the number of errors dropped to less than 10.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Using Dynamic Member Lookup in a Superclass
@reflexx Thanks for the feedback. Hope someone more expert will provide you with a $1 answer. 😉 Otherwise, don’t forget to close the thread. Have a good day.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’25