The quest for SwiftUI knowledge continues along with an awesome Xcode tip…
Welcome to my eleventh weekly newsletter. It is Thursday September 09, 2021.
These are the curated links from the last regular episode.
- Using Variadic Parameters in Swift – SerialCoder.dev
This is an article with a good overview of what variadic arguments are and how you can use them. The Swift print statement is used as an example to explain things, after that it goed right into syntax and how you can use this language feature yourself.
- How to Animate Gradients in SwiftUI
Creating animations on the iOS platform has always been pretty straight forward. There are some animatable properties you can get started with and after that you can just dive into a very deep API supporting pretty crazy things right out of the box. To get you animating within your SwiftUI code, I think this article on AppCoda is a good starting point. Have a look and let me know what you think.
- Conditional compilation within Swift expressions | Swift by Sundell
I still remember creating conditional checks in Objective-c that would just check if a certain message was available on a class. Thankfully we can use Swift's conditional compilation for a while now. But with the release of Swift 5.5 we get a small but very convenient addition to this language feature.John Sundell has a concise overview of what "Conditional compilation within Swift expressions" is about and why it is so useful.
- Exploring SwiftUI map custom annotations | Kristaps Grinbergs
Kristaps has written a nice overview of using custom map annotation in MapKit. Have a look if you want to convert your plain map view into something that uses branding and graphics to better assist your user in using you app.
- View clipping in SwiftUI | FIVE STARS
Clipping and masking is one of those things that I keep forgetting about. And in SwiftUI it is quite easy to do. Check the article by Federico to get yourself started on this topic.
- The Contextual Action Menu | dasdom
Open Xcode, open some code, put the cursor in some element in your editor. Now press ⇧⌘A. Don't have access to a running Xcode instance at the moment? Have a look at Dominik's article for some screenshots.
- Making Documentation that is pleasant to read in Swift
Would you like good documentation with your framework or API? Yes please. Ok, to provide that with Swift code, have a look at this artful article by Leo.
More SwiftUI, and CoreData, and Combine, and CometD
Don't know what CometD is? Well it has something to do with WebSockets. And WebSockets connections you can do on URLSessions only since iOS 13. Guess what I am looking at in my day job. It involves not only WebSockets. But also SwiftUI, CoreData and quite some plumbing between all that based on Combine. You could say I am in a can of worms, but actually everything is starting to fall into place the last couple of days. I feel like I am almost ready to jump in.
And once I jump in it will probably be a couple days worth of coding. Some refactoring, which is probably a nice way of saying some rewriting. I often delete more then I add. Simplify, simplify as much as you can. Try to get away with as little code as possible. Which DOES NOT imply putting a bunch of maps, reduces and filters on one line. I like to be able to read my code next week.
I lived the J2EE days in my career. It was cool and all. But after, I dunno, architecture layer number 7, the returns of just one more layer are not really there. I spilled my coffee one day when someone suggested we apply the "fastlane reader pattern". Search for it on this page. Basically the pattern says... You need performance, heck just bypass all this architecture that does not perform at all and go straight to the database, just make sure to only read the data. Don't write...
So I learned my lesson, out with architectonauts, stay simple, stay nimble. If there is one thing to take away from my newsletter this week, it is this.
On those pesky keyboard switches
As mentioned on my episode I, again, switched all my switches in my Atreus keyboard. Back to the Kailh Box Whites. The speed copper ones are great, but they are just that bit too sensitive for me. I was getting unwanted keypresses just by resting my fingers.
As always, let me know what you think… about my podcast, my newsletter, my book (idea), anything really. My DMs are open.
|