Issue #27
Hi there,
It's getting harder and harder to not share cool things from iOS 16 (that we can't yet use). I'm managing to resist so far. Hope you find something interesting and useful in today's collection!
By the way, if you enjoy reading the newsletter - send it to a colleague ☺️
Using unsafe pointers safely
Unsafe pointers and bytes are only "safe" to use inside the body closure. From withUnsafeMutablePointer
documentation: The pointer argument is valid only for the duration of the function’s execution.
DRY, evolved
Check out this thread about SPOT - Single Point Of Truth principle. It's similar to DRY (Don't Repeat Yourself), but better. I've been looking at code this way as long as I remember - I had no idea this way of thinking had its own name.
This comment perfectly points out the difference between SPOT and DRY:
Beautiful rounded corners
Are you using cornerRadius
for rounding corners? There's a better way - .clipShape
as a RoundedRectangle
with continuous
style in SwiftUI produces a smoother looking result. To achieve the same in UIKit, do button.layer.cornerCurve = .continuous
.
Check this thread for comparison and SwiftUI code:
CloudKit
In issue #21 I shared an article about CloudKit being a red flag for indie developers. The biggest issue named was the inability to transfer the app to another developer account, if a CloudKit entitlement was ever used in the app.
That restriction is now gone - now apps that use iCloud can be transferred to another developer account 🎉
Here's the updated list of criteria for app transfer: App Transfer Criteria
App Store Connect Update - Releases - Apple Developer
Apps that use iCloud can now be transferred to another developer in the Apple Developer Program.
Non-optional Core Data attributes in Swift
There is a distinction between the concept of optional and non-optional values in Swift and Core Data. In Swift, you get compile-time guarantees, but in Core Data, the framework is enforcing the model rules in run-time. Optional Core Data attributes should be optional properties in Swift, but what about non-optional attributes?
In this article Jesse shares a robust approach to handling the differences and making sure the app doesn't crash.
How to more gracefully handle non-optional Core Data properties in Swift · Jesse Squires
🤘☀️☮️
Alright, that’s it for today.
Did you enjoy this issue? Let me know by pressing the buttons below! If you enjoyed it, you can help grow the newsletter by spreading the word ☺️
Got feedback? Want to see more, or less of certain kinds of tips? I’d love to hear from you - just reply to this email 👋
Member discussion