Post

Replies

Boosts

Views

Activity

Reply to Conditional Modifiers *if available*
I did get this to compile and work without needing the extra step of adding the protocol. What it did, need, however, is the return statements. Example: This was my initial approach and does not work: extension View { func cueStyle(font: Font = .system(size: 45)) -> some View { if #available(macOS 26.0, *) { modifier(GlassCueStyle(font: font)) } else { modifier(CueStyle(font: font)) } } } Applying the important part of your answer does, though: extension View { func cueStyle(font: Font = .system(size: 45)) -> some View { if #available(macOS 26.0, *) { return self.modifier(GlassCueStyle(font: font)) } else { return self.modifier(CueStyle(font: font)) } } } Why does it work to add the return statement?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’26
Reply to Displaying an editing hierarchy in macOS
Thanks for your reply. I have ended up going a different direction because I don't understand the way the layout is working in the background still (it might be nice to have a session where I can sketch something and ask an engineer how they would achieve it, but that's beyond the scope of this at the moment). Here's the new form. I think this is much more concise, but I don't know how to pass the selected ballot as a binding in the inspector (see the portion marked with ***, as I have included the type that the Ballot Inspector requires, but not the variable because I don't know what goes there): enum Section: String, Identifiable, CaseIterable { case ballots case candidates var id: Section { self } var systemImageName: String { switch self { case .ballots: return "list.number" case .candidates: return "person.3.sequence.fill" } } } var body: some View { TabView(selection: $selectedSection) { ForEach(Section.allCases) { section in Tab(section.rawValue.capitalized, systemImage: section.systemImageName, value: section) { switch section { case .ballots: BallotListView(document: $document, selectedBallotID: $selectedBallotID) .listStyle(.sidebar) .inspector(isPresented: .constant(true)) { BallotEditor(ballot: ***BINDING<Election.Ballot>***, maxRank: document.election.candidates.count) } case .candidates: Text("Candidates") } } } } .tabViewStyle(.sidebarAdaptable) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’25
Reply to Conditional Modifiers *if available*
Thanks the answer and also for sourcing it. Much appreciated!
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’26
Reply to Conditional Modifiers *if available*
I did get this to compile and work without needing the extra step of adding the protocol. What it did, need, however, is the return statements. Example: This was my initial approach and does not work: extension View { func cueStyle(font: Font = .system(size: 45)) -> some View { if #available(macOS 26.0, *) { modifier(GlassCueStyle(font: font)) } else { modifier(CueStyle(font: font)) } } } Applying the important part of your answer does, though: extension View { func cueStyle(font: Font = .system(size: 45)) -> some View { if #available(macOS 26.0, *) { return self.modifier(GlassCueStyle(font: font)) } else { return self.modifier(CueStyle(font: font)) } } } Why does it work to add the return statement?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’26
Reply to Displaying an editing hierarchy in macOS
Thanks for your reply. I have ended up going a different direction because I don't understand the way the layout is working in the background still (it might be nice to have a session where I can sketch something and ask an engineer how they would achieve it, but that's beyond the scope of this at the moment). Here's the new form. I think this is much more concise, but I don't know how to pass the selected ballot as a binding in the inspector (see the portion marked with ***, as I have included the type that the Ballot Inspector requires, but not the variable because I don't know what goes there): enum Section: String, Identifiable, CaseIterable { case ballots case candidates var id: Section { self } var systemImageName: String { switch self { case .ballots: return "list.number" case .candidates: return "person.3.sequence.fill" } } } var body: some View { TabView(selection: $selectedSection) { ForEach(Section.allCases) { section in Tab(section.rawValue.capitalized, systemImage: section.systemImageName, value: section) { switch section { case .ballots: BallotListView(document: $document, selectedBallotID: $selectedBallotID) .listStyle(.sidebar) .inspector(isPresented: .constant(true)) { BallotEditor(ballot: ***BINDING<Election.Ballot>***, maxRank: document.election.candidates.count) } case .candidates: Text("Candidates") } } } } .tabViewStyle(.sidebarAdaptable) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’25
Reply to Transitioning a freemium app to StoreKit 2
Both development and production. Actually, it turns out I had to remove the AppStore configuration from the build settings for it to talk to the production server. Problem solved!
Topic: App & System Services SubTopic: StoreKit Tags:
Replies
Boosts
Views
Activity
Mar ’25