Alex does a variety of things poorly - swift, data science, datavis, ML, drawing, AR, unity, etc, etc.
by alex
I’m feeling a little better today, jamming to KEXP and working on some 100 Days of SwiftUI.
The challenges today were fun, although two of them highlighted more general issues I’m having with SwiftUI:
.foregroundColor()
or .fontWeight()
, which means if you need to allow for multiple options, you need to use nested ternary operators, which gets messy and ugly as the number of options grows. Maybe there’s a better way?TextField()
- some require formatters, some require prompts, some require strings to be wrapped in Text()
views while others do not, etc. The variety of different initializers for views in SwiftUI can get a little bewildering. They’re not always easy to decode with help from the compiler, either. Using an invalid initializer for a View inside an if #availabile()
block can cause the whole body to fail validation for generic reasons like Return type of property 'body' requires that 'EmptyCommands' conform to 'View'
, whereas it would be helpful in that case to say For this initializer you need to provide a formatter
or something. To be fair, some of this may be down to Xcode beta issues.At any rate, still really enjoying myself with SwiftUI and the 100 Days of SwiftUI project.
tags: swift - swiftui