Post

Replies

Boosts

Views

Activity

Reply to List changing into a different mode in a different view
Your SheetView NavigationView is using the default style of .columns. You want .stack Add this modifier to the SheetView NavigationView: .navigationViewStyle(.stack) Like this: var body: some View { NavigationView { VStack { SheetListView() Spacer() HStack { Text("App version 0.1 (DEV)") .foregroundColor(.gray) } .toolbar { Button("Done") { dismiss() } .font(.headline) .padding() } } .background(Color(.systemGroupedBackground)) } .navigationViewStyle(.stack) /// **.stack** } Extra Hint: when pasting code to the forum, use "Paste and Match Style", to avoid the extra blank lines.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’21
Reply to Cannot convert value of type '[Double]' to expected argument type 'Double'
@H957169 some friendly tips: Please remember always to respond, when people try to help you. Include enough information in your question to allow people to understand your problem. When one of your questions is answered, remember to mark the question as answered. Then the forum will work as intended, and people will be more likely to help you in future.
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21
Reply to Alert isn't presenting when we use confirmationDialog in a View Xcode 13
Try this: @State private var showingOptions = false @State private var showingAlert = false var body: some View { VStack { Button("Show Options") { showingOptions = true } .alert(isPresented: $showingAlert) { Alert(title: Text("Alert"), message: Text("Message"), dismissButton: .default(Text("OK"))) } .confirmationDialog("Select option", isPresented: $showingOptions, titleVisibility: .visible) { Button("Show Alert") { self.showingAlert = true } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’21
Reply to DateFormatter vs leap seconds
Leap seconds are a long-running saga on macOS (and all Unix OSes). If you periodically sync your time with a server, then things are generally fine. But if you need to-the-second accuracy, while a leap-second is added, and you are performing date maths, then maybe not so good! If you have developed a workaround, please share it here!
Topic: App & System Services SubTopic: General Tags:
Oct ’21
Reply to iOS 15 - New JSONDecoding Decimals issue
Also interesting: struct DTO: Decodable { let amount: Double var decimal: Decimal { Decimal(amount) } } amount and decimal both print as 9.21 Or (better) try this: struct DTO: Decodable { let amount: Decimal enum CodingKeys: CodingKey { case amount } init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) let doubleValue = try container.decode(Double.self, forKey: .amount) amount = Decimal(doubleValue) } } This is basically keeping it simple for the JSON... JSON can do Doubles... ...then we convert to the Decimal that we really want. Plug-in this updated DTO to your project, and the rest of your code remains as-is.
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’21