Posts

Post not yet marked as solved
2 Replies
724 Views
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 } }
Posted
by jedilord.
Last updated
.