Posts

Post not yet marked as solved
1 Replies
436 Views
let formatter = DateIntervalFormatter() formatter.dateStyle = .none formatter.timeStyle = .none formatter.dateTemplate = "EEEjm" Produces, in my locale and on my device with 24 hour time on: "Tue, 6:39 – 7:10 pm" I was expecting: "Tue, 18:39 – 19:10" Other date formatters are showing 24 hour time using the j symbol. For example: let formatter = DateFormatter() formatter.dateStyle = .none formatter.timeStyle = .none formatter.setLocalizedDateFormatFromTemplate("EEEjm") Produces, for the start and end dates: Tue 18:39 Tue 19:10 Further, NSDateIntervalFormatter.h suggests I should be able to use symbols like j. So why can't I create strings in 24 hour time with DateIntervalFormatter? Thanks for your time. iOS 16.7.1 / Xcode 15
Posted Last updated
.
Post marked as solved
5 Replies
24k Views
I'm getting the following compiler error.error: function declares an opaque return type, but the return statements in its body do not have matching underlying types var body: some View { ^I'm trying to switch on some state to determine what the rest of the view hierachy looks like. How do I do this in SwiftUI? Thanks!enum Choices: Equatable, Hashable { case one case two } struct HeaderView: View { @State var choices = Choices.one var body: some View { switch choices { case .two: return ChoiceTwoView(choices: $choices) default: return ChoiceOneView(choices: $choices) } } } struct ChoiceOneView: View { @Binding var choices: Choices init(choices: Binding) { $choices = choices } var body: some View { VStack { HStack { Image(systemName: "person.icloud") VStack(alignment: .leading) { Text("Person Name") .font(.headline) Text("Some long long long long long long long long text") .lineLimit(nil) .multilineTextAlignment(.leading) } } } } } struct ChoiceTwoView: View { @Binding var choices: Choices init(choices: Binding) { $choices = choices } var body: some View { VStack { HStack { Image(systemName: "person.icloud") VStack(alignment: .leading) { Text("Person Name") .font(.headline) } } } } }
Posted Last updated
.