Post

Replies

Boosts

Views

Activity

Reply to User changes Settings for my app, any notification?
If you define UserDefaults that cover all the settings you have through System settings of the app and register defaults, that connects UserDefaults to Root.pList. UserDefaults.standard.register(defaults: defaults) Define a notification name extension Notification.Name { public static let kRefreshPrefs = Notification.Name("refreshPrefs") } Then, in AppDelegate, post notification when you enter foreground because you return from System Settings func applicationWillEnterForeground(_ application: UIApplication) { NotificationCenter.default.post(name: .kRefreshPrefs, object: self) } or do the same in SceneDelegate func sceneWillEnterForeground(_ scene: UIScene) { NotificationCenter.default.post(name: .kRefreshPrefs, object: self) } In ViewControllers when you need to know setting has changed, add an observer NotificationCenter.default.addObserver(self, selector: #selector(refreshUserPrefs), name: .kRefreshPrefs, object: nil) and do what you need to do in the selector
May ’25
Reply to Animation does not work with List, while works with ScrollView + ForEach
@Kopyl I tested with longer duration (3.0) and the difference is crystal clear. I have a real answer, but it is apparently a known issue with List https://stackoverflow.com/questions/74253108/why-is-animation-not-working-in-a-list-but-is-working-in-vstack List manages its own scrolling (List has an implicit ScrollView (as does Form)), making it pretty inflexible for defining behaviour for animation and forcing to use ScrollView instead. May also read this: https://stackoverflow.com/questions/76418666/swiftui-list-animations-are-not-smooth-when-adding-elements-to-a-vstack-in-a-lis
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to App validation fails because of companyName
Welcome to the forum. Did you register as individual developer or company ? I would not for in Organizer Window, but register the app from the appstore Portal. Did you try it ? Some users had problems, because they had to sign the agreement. Is it your case ? https://developer.apple.com/forums/thread/699991 Also see here, for similar issue and a solution: https://cloud.tencent.com/developer/article/1919660 You may have a look here to find some hints: https://discussions.apple.com/thread/3821416?sortBy=rank
May ’25
Reply to 1 app with 4 different names in 4 different countries' app stores
Welcome on the forum. For iOS, just localise the name that appears on the device's home screen via InfoPlist.strings /* Bundle name */ "CFBundleName" = "MyAppNo"; // In Norway InfoPlist file "CFBundleName" = "MyAppDk"; // In Danish InfoPlist file Get details here: https://stackoverflow.com/questions/10616650/how-to-make-ios-app-name-localizable If that's OK, don't forget to close the thread by marking the answer as correct. Otherwise, explain more in detail what you are looking for. For Android, you should ask on an Android forum.
May ’25
Reply to onReceive(_:perform:) on Frontmost Window Only?
don't even know what this @FocusedBinding guy is. I find this is more and more a problem with SwiftUI. At the beginning, it was made to be very simple (and it is for very simple apps). But with the need to get more flexibility (closer to UIKit), it is now adding a lot of concepts such as @FocusedBinding, to "turn around" the limits of State based architecture. Simplicity has gone. In your case, can't you add a user info, with the ID of the window for instance ? And test in each window if the notification if for itself.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to Checking the contents of a TextField variable method not working
You don't say on which line is the error (are you sure it is in this part of code ?), but this appears wrong for char in charArray { if char != allowed { char is a Character but allowed is probably an array of Character (you don't show much code, so we have to check, which is a bit boring). Correct syntax would be (if I understand correctly your intent and if charArray is effectively an array of Character, which is likely as cards.firstCardLatitude is a String) for char in charArray { if !allowed.contains(char) { If that works, don't forget to close the thread by marking the correct answer ; otherwise show more code.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to Facing the same error
@Brij_iOS25 Seems you are new here, so welcome to the forum. You should read the excellent post of Quinn's on how to properly use the forum, (which is not a social network wall to post one's own feelings, except maybe in forums feedback, but a place to ask questions to other developers). https://developer.apple.com/forums/thread/706527 Have a good day.
Topic: App & System Services SubTopic: StoreKit Tags:
May ’25
Reply to ios 18.5
I fear no one here can tell. So, read carefully the release notes to check if the bug you have in mind is corrected. Did you file a bug report about it ? It would help.
Topic: Community SubTopic: Apple Developers Tags:
May ’25
Reply to Behavior of Drawings in Portrait/Landscape Mode
I tested your code. When rotating, the canvas size changes, but the drawing remains the same. I cannot find immediately in your code what should make the existing drawing scale to the new format. Where is it ? Is it here ? override func draw(_ rect: CGRect) { super.draw(rect) guard let context: CGContext = UIGraphicsGetCurrentContext() else { return } for stroke in Database.strokes { context.setLineCap(.round) context.setLineJoin(.round) context.setLineWidth(2.0) context.setAlpha(1.0) context.setBlendMode(.normal) context.setStrokeColor(UIColor.black.cgColor) context.addPath(stroke.path) context.strokePath() } } But Database.strokes is not scaled on device rotation. Why should the drawing change ? Try to scale Database.strokes when you rotate device, then drawing will adapt.
Topic: UI Frameworks SubTopic: UIKit Tags:
May ’25
Reply to Random crash on app language change from app
Why do you create a new root VC ? You should not. You simply have to: use NSLocalizedString everywhere go to app setting to change the language there For this, I use openSettings: @objc func openSettings() { guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else { return } if UIApplication.shared.canOpenURL(settingsUrl) { UIApplication.shared.open(settingsUrl, completionHandler: nil) } } It is called from an alert, could be from any button: Here is the alert action okAction = UIAlertAction(title: "any title you want", style: .default, handler: { (action) -> Void in self.openSettings()} )
Topic: UI Frameworks SubTopic: UIKit Tags:
Apr ’25
Reply to User changes Settings for my app, any notification?
If you define UserDefaults that cover all the settings you have through System settings of the app and register defaults, that connects UserDefaults to Root.pList. UserDefaults.standard.register(defaults: defaults) Define a notification name extension Notification.Name { public static let kRefreshPrefs = Notification.Name("refreshPrefs") } Then, in AppDelegate, post notification when you enter foreground because you return from System Settings func applicationWillEnterForeground(_ application: UIApplication) { NotificationCenter.default.post(name: .kRefreshPrefs, object: self) } or do the same in SceneDelegate func sceneWillEnterForeground(_ scene: UIScene) { NotificationCenter.default.post(name: .kRefreshPrefs, object: self) } In ViewControllers when you need to know setting has changed, add an observer NotificationCenter.default.addObserver(self, selector: #selector(refreshUserPrefs), name: .kRefreshPrefs, object: nil) and do what you need to do in the selector
Replies
Boosts
Views
Activity
May ’25
Reply to Animation does not work with List, while works with ScrollView + ForEach
@Kopyl I tested with longer duration (3.0) and the difference is crystal clear. I have a real answer, but it is apparently a known issue with List https://stackoverflow.com/questions/74253108/why-is-animation-not-working-in-a-list-but-is-working-in-vstack List manages its own scrolling (List has an implicit ScrollView (as does Form)), making it pretty inflexible for defining behaviour for animation and forcing to use ScrollView instead. May also read this: https://stackoverflow.com/questions/76418666/swiftui-list-animations-are-not-smooth-when-adding-elements-to-a-vstack-in-a-lis
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to App validation fails because of companyName
Welcome to the forum. Did you register as individual developer or company ? I would not for in Organizer Window, but register the app from the appstore Portal. Did you try it ? Some users had problems, because they had to sign the agreement. Is it your case ? https://developer.apple.com/forums/thread/699991 Also see here, for similar issue and a solution: https://cloud.tencent.com/developer/article/1919660 You may have a look here to find some hints: https://discussions.apple.com/thread/3821416?sortBy=rank
Replies
Boosts
Views
Activity
May ’25
Reply to 1 app with 4 different names in 4 different countries' app stores
Welcome on the forum. For iOS, just localise the name that appears on the device's home screen via InfoPlist.strings /* Bundle name */ "CFBundleName" = "MyAppNo"; // In Norway InfoPlist file "CFBundleName" = "MyAppDk"; // In Danish InfoPlist file Get details here: https://stackoverflow.com/questions/10616650/how-to-make-ios-app-name-localizable If that's OK, don't forget to close the thread by marking the answer as correct. Otherwise, explain more in detail what you are looking for. For Android, you should ask on an Android forum.
Replies
Boosts
Views
Activity
May ’25
Reply to onReceive(_:perform:) on Frontmost Window Only?
don't even know what this @FocusedBinding guy is. I find this is more and more a problem with SwiftUI. At the beginning, it was made to be very simple (and it is for very simple apps). But with the need to get more flexibility (closer to UIKit), it is now adding a lot of concepts such as @FocusedBinding, to "turn around" the limits of State based architecture. Simplicity has gone. In your case, can't you add a user info, with the ID of the window for instance ? And test in each window if the notification if for itself.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Checking the contents of a TextField variable method not working
You don't say on which line is the error (are you sure it is in this part of code ?), but this appears wrong for char in charArray { if char != allowed { char is a Character but allowed is probably an array of Character (you don't show much code, so we have to check, which is a bit boring). Correct syntax would be (if I understand correctly your intent and if charArray is effectively an array of Character, which is likely as cards.firstCardLatitude is a String) for char in charArray { if !allowed.contains(char) { If that works, don't forget to close the thread by marking the correct answer ; otherwise show more code.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Facing the same error
@Brij_iOS25 Seems you are new here, so welcome to the forum. You should read the excellent post of Quinn's on how to properly use the forum, (which is not a social network wall to post one's own feelings, except maybe in forums feedback, but a place to ask questions to other developers). https://developer.apple.com/forums/thread/706527 Have a good day.
Topic: App & System Services SubTopic: StoreKit Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to ios 18.5
I fear no one here can tell. So, read carefully the release notes to check if the bug you have in mind is corrected. Did you file a bug report about it ? It would help.
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Behavior of Drawings in Portrait/Landscape Mode
I tested your code. When rotating, the canvas size changes, but the drawing remains the same. I cannot find immediately in your code what should make the existing drawing scale to the new format. Where is it ? Is it here ? override func draw(_ rect: CGRect) { super.draw(rect) guard let context: CGContext = UIGraphicsGetCurrentContext() else { return } for stroke in Database.strokes { context.setLineCap(.round) context.setLineJoin(.round) context.setLineWidth(2.0) context.setAlpha(1.0) context.setBlendMode(.normal) context.setStrokeColor(UIColor.black.cgColor) context.addPath(stroke.path) context.strokePath() } } But Database.strokes is not scaled on device rotation. Why should the drawing change ? Try to scale Database.strokes when you rotate device, then drawing will adapt.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Random crash on app language change from app
Why do you create a new root VC ? You should not. You simply have to: use NSLocalizedString everywhere go to app setting to change the language there For this, I use openSettings: @objc func openSettings() { guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else { return } if UIApplication.shared.canOpenURL(settingsUrl) { UIApplication.shared.open(settingsUrl, completionHandler: nil) } } It is called from an alert, could be from any button: Here is the alert action okAction = UIAlertAction(title: "any title you want", style: .default, handler: { (action) -> Void in self.openSettings()} )
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Apr ’25