Post

Replies

Boosts

Views

Activity

Have you had a spurious build appear in App Store Connect / Testflight?
I had just uploaded a new build of my app and it had been processed. I went to submit it for beta testing, when I noticed another build with the next build number "processing." But I never submitted any such build. I went back to my project and double-checked the version number. It was what I expected it to be: one lower than this mysterious build that suddenly appeared. App Store Connect now shows that this mystery build is ready to be submitted. I'm the only developer on this app. Has anyone seen this before? Thanks!
0
0
742
Dec ’21
How are you supposed to test Mac apps that support Mac OS earlier than 12?
Our QA team is trying to test our application on all platforms we support, but Apple has inexplicably blocked installation of TestFlight on OS 11. Does anyone know the rationale behind this, or how we're supposed to distribute test builds in an orderly manner now? Having to make ad-hoc builds piecemeal and E-mail them around with duplicated instructions is not exactly professional. Thanks for any insight!
0
0
754
Jan ’22
Why would you use @State at the application level, or anywhere outside SwiftUI?
I am trudging through the doc on the seemingly endless ways to expose model data through a view hierarchy. The Apple doc here provides this example: struct BookReaderApp: App { @State private var library = Library() var body: some Scene { WindowGroup { LibraryView() .environment(\.library, library) } } } Why would you do this? Is the Library at risk of being repeatedly destroyed and re-created? Also, Library is defined as an Observable class, not a struct. So why is it @State and not @StateObject?
1
0
584
Dec ’23
How do you control the volume of ApplicationMusicPlayer?
I need to duck the audio coming from ApplicationMusicPlayer while playing a local file using AVAudioPlayer. I've tried using the duckOthers option as follows, but it doesn't work: let appAudioSession = AVAudioSession.sharedInstance() do { try appAudioSession.setCategory(.playAndRecord, mode: .default, options: .duckOthers) Maybe this is because there's one session for the entire app, and ApplicationMusicPlayer is using it? This is a fairly critical problem for my application, since Music content is always much louder than locally recorded content. Any insight appreciated.
0
0
694
Mar ’24
MacOS "Made for iPad" builds are not being updated by Xcode
I suddenly noticed that changes I made in code had no effect on the app when I rebuilt it and ran it on my M1 Mac as a "made for iPad" target. The debugger will even stop on new lines and seem to execute them, but they do nothing. If I clean the build folder and re-run, the same line executes as expected. This wastes an incredible amount of time until you discover what's happening. Now I have to remember to clean build folder every time I build and run. The application's structure is very simple, with no included libraries or third-party dependencies. Anybody else seeing this? Xcode 15.3 under Sonoma (14.4.1).
0
0
603
Apr ’24
How do you pass a view builder into a view?
I'm making a custom control, specifically a checkbox next to a "label." I want the label parameter, like many in Apple's built-in controls, to take a view-building closure. But I can't figure out the correct syntax. I looked at the declaration of Apple's NavigationLink control for clues: public struct NavigationLink<Label, Destination> : View where Label : View, Destination : View { /// Creates a navigation link that presents the destination view. /// - Parameters: /// - destination: A view for the navigation link to present. /// - label: A view builder to produce a label describing the `destination` /// to present. public init(@ViewBuilder destination: () -> Destination, @ViewBuilder label: () -> Label) But when I mimic this, the compiler complains about the body() function: struct CheckboxItem<Label> : View where Label : View { let stateCheck: () -> Bool let label: () -> any View let boxSize: CGFloat init(withStateCheck: @escaping () -> Bool, boxSize: CGFloat, @ViewBuilder label: @escaping () -> Label) { stateCheck = withStateCheck self.label = label self.boxSize = boxSize } var body: some View { HStack { <-- ERROR: "Type 'any View' cannot conform to 'View'" Image(systemName: stateCheck() ? "checkmark.square" : "square") .resizable() .aspectRatio(contentMode: .fit) .frame(width: boxSize, height: boxSize) .foregroundColor(AppStyle.labelColor) .opacity(0.75) label() } } } Also, note that I had to put @escaping before my label parameter, but that's not seen in Apple's. Any ideas?
Topic: UI Frameworks SubTopic: SwiftUI
1
0
201
Mar ’25
Can't find any realistic example of how to use NavigationPath
Like many applications, mine involves navigation where the user starts a process on one screen and then progresses through several more steps to reach a conclusion. When he confirms that choice, I need to dismiss the entire stack. In my case, he's browsing contacts, selecting one, and then selecting a communication method from those offered by the contact. This still appears to be a PITA in SwiftUI. NavigationPath is supposed to provide a way to programmatically control a stack of views. Well... I can't find a single example of how to use it for this, except with absurdly shallow (as in a single level) of child views that all take the same datatype. Nowhere do I see how to use the path as users proceed through your view hierarchy with NavigationLinks. I have not seen any example of how elements get added to the path or how they are related to each added view. Nor can I find an example of popping views off the stack by removing related elements from the path. I created a class that encloses a NavigationPath: @Observable class NavPathController { var path: NavigationPath init() { path = NavigationPath() } func popOne() { path.removeLast() } func popAll() { path.removeLast(path.count) } } In my root view, I pass a binding to this controller's NavigationPath when creating the NavigationStack: @State private var viewStack = NavPathController() var body: some View { NavigationStack(path: $viewStack.path) { VStack() { NavigationLink(destination: UserFindingView(viewPathController: viewStack), label: { Text("Pick a recipient") }) } } And likewise each view passes the same view-path controller object to each child view that's invoked with a NavigationLink (instead of using an environment variable, because I find those hokey). But in the end, the path is empty; not surprisingly, clearing it does not pop the views. So how is one supposed to make this work?
Topic: UI Frameworks SubTopic: SwiftUI
1
0
197
Mar ’25