Post

Replies

Boosts

Views

Activity

Reply to Persistent 'buildExpression unavailable' error in ContentView with switch/AppState
You don't need the Groups unless you're doing something with them, like adding modifiers that would apply to all of the contents. (Think of adding a .bold() modifier to the Group to apply bold rather than having to add three separate instances of .bold().) That's just a guess, though. Second guess, is it because you're creating a preview with three separate instances of the ContentView() and Xcode is getting confused? Can you try three separate previews?
Topic: UI Frameworks SubTopic: SwiftUI
Apr ’25
Reply to How are we supposed to get Ipad screenshots for our store, without having an Ipad? haha
If your app is supposed to work on an iPad then you need to provide screenshots for the iPad. You can do this by building and running on an iPad Simulator on your Mac. If your app is not going to support the iPad then you need to load your project in Xcode, and remove the platforms it doesn't support. This is done in the General tab of the project view's targets. You know there this is? In the left-hand list of your prject's files, the very top blue item is your project name. Click that, and the right-hand side shows your project and a list of targets. Click the targets one by one and remove the iPad from there. You'll need to rebuild the project and confirm it all works, and submit it to App Store Connect. You shouldn't need to add iPad screenshots then.
Mar ’25
Reply to How to control when a DatePicker "pops up"
The result of tapping the "unscheduled" button is not to set the date to .now, but to allow the user to schedule the activity, presumably sometime in the future But that would involve more than one tap anyway, wouldn't it? My example of .now was just an example so that the DatePicker would be displayed with a valid date, and not the year 4000 as you required. You could choose to craft a date for one week today at noon instead. If you want a cleaner UI then you should maybe do as I suggested and have the DatePicker disabled if it's unscheduled, and have a toggle that enables the picker? import SwiftUI struct ContentView: View { @State private var scheduled: Bool = false @State private var date: Date = .now.advanced(by: 24 * 7 * 60 * 60) var body: some View { VStack { Toggle("Scheduled", isOn: $scheduled) .padding(.horizontal) Group { HStack { DatePicker("Date", selection: $date) .disabled(!scheduled) .opacity(scheduled ? 1 : 0.4) } .padding() } .border(.black.opacity(scheduled ? 1 : 0.2), width: 2) .padding(.horizontal) } } } #Preview { ContentView() } Unscheduled: Scheduled: Or the HStack in the middle (lines 13-15) could be changed to this so you only ever see a date when the toggle is on: if(scheduled) { DatePicker("Date", selection: $date) .disabled(!scheduled) .opacity(scheduled ? 1 : 0.4) } else { Text("Toggle switch to schedule") .frame(maxWidth: .infinity) .opacity(scheduled ? 1 : 0.4) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Reply to Need guidance for creating the xcprivacy file WITHOUT A MAC when coding on flutter, especially when third party sdks are there.
I don't think it matters whether you're using any SDKs, does it? When I create a new privacy file in Xcode I'm not asked to select SDKs. All I'm asked is what to call it, where to save the file, and which app targets it applies to. That said, it's just a property list XML file. Here's a simple example: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSPrivacyAccessedAPITypes</key> <array> <dict> <key>NSPrivacyAccessedAPIType</key> <string>NSPrivacyAccessedAPICategoryUserDefaults</string> <key>NSPrivacyAccessedAPITypeReasons</key> <array> <string>1C8F.1</string> </array> </dict> </array> </dict> </plist> Be sure to choose the correct values from here: https://developer.apple.com/documentation/bundleresources/privacy-manifest-files
Mar ’25
Reply to I sent Proposal for Apple Silicon.app
The Feedback Assistant is for everyone to send Apple feedback, issues, bug reports, and suggestions. Your suggestion was correctly sent to Apple via the Feedback Assistant. If they have any questions about your feedback, they will be in touch with you. These are the Developer Forums, where developers of third-party apps for Apple's platforms ask each other for hints and tips on coding. As such, this isn't the right place to ask for feedback on your suggestion. Thank you.
Topic: App & System Services SubTopic: Hardware Tags:
Mar ’25
Reply to How to control when a DatePicker "pops up"
Can you not simply change the date so that the DatePicker appears? import SwiftUI struct ContentView: View { @State private var date: Date = .distantFuture var body: some View { HStack { if(date == .distantFuture) { Text("Date") Button("unscheduled") { date = .now // <<-- This is the important bit } .buttonStyle(.bordered) } else { DatePicker("Date", selection: $date) } } .padding() } } #Preview { ContentView() } The only thing with this is that the button can never be re-displayed, i.e. once you click it to change date to .now you cannot change it back to .distantFuture. If you need to do that, you'll have to add some extra UI for that to happen. If I needed to do that, I'd actually put this control in its own section, and have a check box showing it's scheduled when checked (and the DatePicker is then enabled), and unscheduled when not checked (no DatePicker, maybe just some text saying it's unscheduled).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Reply to Feature duration
Wrong place for feature suggestions. These are the Developer Forums, where developers of third-party apps for Apple's platforms ask each other for hints and tips on coding. These forums are not where Apple's actual developers chat about new features. If you have a suggestion, you should raise it at: https://www.apple.com/feedback/
Topic: Community SubTopic: Apple Developers Tags:
Mar ’25
Reply to scenePhase not behaving as expected on screen lock
Coupe of things here. I'll assume you've set scenePhase using: @Environment(\.scenePhase) private var scenePhase If so, you don't need phase in; you can simply refer to scenePhase, i.e.: .onChange(of: scenePhase) { if(scenePhase == .active) { Secondly, scenePhase does not equal UIApplication.shared.applicationState. An application can be active and a scene can be inactive. That's why you're seeing your debug output. The app goes into the background after a few seconds, to allow you to complete any processing you needed to do - writing to a file, or database, whatever. The scene will go into the background before the app. Do you really need to know if the app state has changed, or the scene? It seems you're mixing two things here.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Reply to popup window don't react to touch on iOS 18, works fine on iOS 17
Please format your code properly in future. Once you submit your post, take a look and make sure it looks fine. If it doesn't, you have an hour to edit the post. Right now, the gobbledegook at the top is difficult to understand.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Apr ’25
Reply to Persistent 'buildExpression unavailable' error in ContentView with switch/AppState
You don't need the Groups unless you're doing something with them, like adding modifiers that would apply to all of the contents. (Think of adding a .bold() modifier to the Group to apply bold rather than having to add three separate instances of .bold().) That's just a guess, though. Second guess, is it because you're creating a preview with three separate instances of the ContentView() and Xcode is getting confused? Can you try three separate previews?
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Apr ’25
Reply to Piece of code in Playground that reliably crashes lldb server
Two things: Raise a bug, like the error tells you to. Don't post screenshots of errors as they cannot be searched for when someone else encounters the same issue. Thanks.
Replies
Boosts
Views
Activity
Apr ’25
Reply to Memory Leak in AVAudioPlayer in Simulator only
You should probably raise this as a bug in the usual way. It won't really get progressed if it's only posted in these Developer Forums. You need to raise each issue you find separately at https://feedbackassistant.apple.com/ You can post the FB numbers here if you want, so that others can link to them.
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to How are we supposed to get Ipad screenshots for our store, without having an Ipad? haha
If your app is supposed to work on an iPad then you need to provide screenshots for the iPad. You can do this by building and running on an iPad Simulator on your Mac. If your app is not going to support the iPad then you need to load your project in Xcode, and remove the platforms it doesn't support. This is done in the General tab of the project view's targets. You know there this is? In the left-hand list of your prject's files, the very top blue item is your project name. Click that, and the right-hand side shows your project and a list of targets. Click the targets one by one and remove the iPad from there. You'll need to rebuild the project and confirm it all works, and submit it to App Store Connect. You shouldn't need to add iPad screenshots then.
Replies
Boosts
Views
Activity
Mar ’25
Reply to Video preview
Is this an iOS app? If so, perhaps your video settings are wrong in your iOS Settings app? If so, re-record it. Or you can use something like ffmpeg or Handbrake to re-encode the existing file.
Replies
Boosts
Views
Activity
Mar ’25
Reply to Detached Keychain Suggestion Transparent UI when Programmatically Focusing NSSecureTextField (AppKit/Objective-C)
You should probably raise this as a bug in the usual way. It won't really get progressed if it's only posted in these Developer Forums. You need to raise each issue you find separately at https://feedbackassistant.apple.com/ You can post the FB numbers here if you want, so that others can link to them.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to How to control when a DatePicker "pops up"
The result of tapping the "unscheduled" button is not to set the date to .now, but to allow the user to schedule the activity, presumably sometime in the future But that would involve more than one tap anyway, wouldn't it? My example of .now was just an example so that the DatePicker would be displayed with a valid date, and not the year 4000 as you required. You could choose to craft a date for one week today at noon instead. If you want a cleaner UI then you should maybe do as I suggested and have the DatePicker disabled if it's unscheduled, and have a toggle that enables the picker? import SwiftUI struct ContentView: View { @State private var scheduled: Bool = false @State private var date: Date = .now.advanced(by: 24 * 7 * 60 * 60) var body: some View { VStack { Toggle("Scheduled", isOn: $scheduled) .padding(.horizontal) Group { HStack { DatePicker("Date", selection: $date) .disabled(!scheduled) .opacity(scheduled ? 1 : 0.4) } .padding() } .border(.black.opacity(scheduled ? 1 : 0.2), width: 2) .padding(.horizontal) } } } #Preview { ContentView() } Unscheduled: Scheduled: Or the HStack in the middle (lines 13-15) could be changed to this so you only ever see a date when the toggle is on: if(scheduled) { DatePicker("Date", selection: $date) .disabled(!scheduled) .opacity(scheduled ? 1 : 0.4) } else { Text("Toggle switch to schedule") .frame(maxWidth: .infinity) .opacity(scheduled ? 1 : 0.4) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to Video preview
What's your frame rate? Have you tried reducing it?
Replies
Boosts
Views
Activity
Mar ’25
Reply to Need guidance for creating the xcprivacy file WITHOUT A MAC when coding on flutter, especially when third party sdks are there.
I don't think it matters whether you're using any SDKs, does it? When I create a new privacy file in Xcode I'm not asked to select SDKs. All I'm asked is what to call it, where to save the file, and which app targets it applies to. That said, it's just a property list XML file. Here's a simple example: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSPrivacyAccessedAPITypes</key> <array> <dict> <key>NSPrivacyAccessedAPIType</key> <string>NSPrivacyAccessedAPICategoryUserDefaults</string> <key>NSPrivacyAccessedAPITypeReasons</key> <array> <string>1C8F.1</string> </array> </dict> </array> </dict> </plist> Be sure to choose the correct values from here: https://developer.apple.com/documentation/bundleresources/privacy-manifest-files
Replies
Boosts
Views
Activity
Mar ’25
Reply to I sent Proposal for Apple Silicon.app
The Feedback Assistant is for everyone to send Apple feedback, issues, bug reports, and suggestions. Your suggestion was correctly sent to Apple via the Feedback Assistant. If they have any questions about your feedback, they will be in touch with you. These are the Developer Forums, where developers of third-party apps for Apple's platforms ask each other for hints and tips on coding. As such, this isn't the right place to ask for feedback on your suggestion. Thank you.
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to How to control when a DatePicker "pops up"
Can you not simply change the date so that the DatePicker appears? import SwiftUI struct ContentView: View { @State private var date: Date = .distantFuture var body: some View { HStack { if(date == .distantFuture) { Text("Date") Button("unscheduled") { date = .now // <<-- This is the important bit } .buttonStyle(.bordered) } else { DatePicker("Date", selection: $date) } } .padding() } } #Preview { ContentView() } The only thing with this is that the button can never be re-displayed, i.e. once you click it to change date to .now you cannot change it back to .distantFuture. If you need to do that, you'll have to add some extra UI for that to happen. If I needed to do that, I'd actually put this control in its own section, and have a check box showing it's scheduled when checked (and the DatePicker is then enabled), and unscheduled when not checked (no DatePicker, maybe just some text saying it's unscheduled).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to Why does Array.contains cause a compile-time error when comparing an optional value with a non-optional value in Swift?
Answered in your duplicate post. (Please don't raise duplicate posts.)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to Feature duration
Wrong place for feature suggestions. These are the Developer Forums, where developers of third-party apps for Apple's platforms ask each other for hints and tips on coding. These forums are not where Apple's actual developers chat about new features. If you have a suggestion, you should raise it at: https://www.apple.com/feedback/
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to scenePhase not behaving as expected on screen lock
Coupe of things here. I'll assume you've set scenePhase using: @Environment(\.scenePhase) private var scenePhase If so, you don't need phase in; you can simply refer to scenePhase, i.e.: .onChange(of: scenePhase) { if(scenePhase == .active) { Secondly, scenePhase does not equal UIApplication.shared.applicationState. An application can be active and a scene can be inactive. That's why you're seeing your debug output. The app goes into the background after a few seconds, to allow you to complete any processing you needed to do - writing to a file, or database, whatever. The scene will go into the background before the app. Do you really need to know if the app state has changed, or the scene? It seems you're mixing two things here.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’25