Post

Replies

Boosts

Views

Activity

StringInterpolation inside SwiftUI
Anyone able to get custom StringInterpolations to work inside SwiftUI Text view?extension String.StringInterpolation { mutating func appendInterpolation(justDate value: Date) { let formatter = DateFormatter() formatter.dateFormat = "yyyy-MM-dd" let dateString = formatter.string(from: value) appendLiteral(dateString) } } struct MyView: View { var body: some View { Text("Now: \(justDate: Date())"}) // Doesn't work } func test() { print("Now: \(justDate: Date())") // Works } }
2
0
819
Jun ’19