Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
I'm trying really hard to like Swift but every time I open the hood on this bird, it takes a shit on my windshield.
For example:
struct ContentView: View {
var body: some View {
let kFontPointSize = 25.0
var theFont: Font = .system( size: kFontPointSize )
theFont = .custom("Helvetica", size: kFontPointSize )
Text("Hello, World!")
.padding(.horizontal, 20.0)
.font( theFont )
}
}
... in spite of how wonderfully self documenting (🐂💩) Swift is, that dirty bird converts the 'var' to a 'let' and "theFont" cannot be reassigned after declaration.
3 things:
1. invisibly converting the 'var' to a 'let' and not indicating 'var' can't be used... really?! Suppose to just "know" these obscure inconsistencies? (sloppy design)
2. then the error Xcode presents on "theFont = ..." line is : "Type '()' cannot conform to 'View'"!? How about "can't use a 'var' here"? God forbid it should make sense. (sloppy design)
3. "var" means variable and "let" means letstant? If you are going to use "var", better use "const", or be consistent and use "set" and "let" instead of "var" and "let" (sloppy inconsistency)
4. and ".horizontal", who owns that? Self documenting?. It is owned Edge Set aka Edge.Set.horizontal and effectively a "global".
5. And reading the Swift coder's mind... No, you should NEVER NEVER NEVER use "25" as a constant literal passed like .system( size: 25 ). (magic numbers not aloud)
Have all best engineering practices been simply tossed out the window? Rule #1 in software "engineering": Globals are BAD. Corollary: magic numbers earn you a one-legged A on your project.
I am so incredibly disappointed in the Swift community right now. Swift designers are honestly earning a "script kiddy" badge of dishonor.
devrant
xcode