Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

NSManagedObject events: handling state in Core Data

An NSManagedObject lifecycle goes from insertion and updates until deletion in the end. All those events come with their own common related modifications and can be used in many different ways. Managing state in Core Data from within the NSManagedObject class itself is a great way to keep logic centralized. Updating a creation date, modified … 

 

Try Catch Throw: Error Handling in Swift with Code Examples

Try catch in Swift combined with throwing errors make it possible to nicely handle any failures in your code. A method can be defined as throwing which basically means that if anything goes wrong, it can throw an error. To catch this error, we need to implement a so-called do-catch statement. It’s not always required … 

 

Overriding UserDefaults for improved productivity

UserDefaults within apps are used to store data related to user configurations. It’s an easily accessible data store for saving states, statistics, and other app-related data. Launch arguments are passed to the application on launch and can be used to alter the application for debugging purposes. It’s often used by Apple to allow developers to … 

 

How-to use Diffable Data Sources with Core Data

Diffable Data Sources were introduced at WWDC 2019 as a replacement for UICollectionViewDataSource and UITableViewDataSource. The API is available on iOS 13 and up and makes it easy to set up lists of data in which changes are managed through so-called snapshots. The Core Data team added new delegate methods to the NSFetchedResultsControllerDelegate to make … 

 

Diffable Data Sources Adoption with Ease

Diffable Data Sources were introduced at WWDC 2019 and are available since iOS 13. They’re a replacement of the good old UICollectionViewDataSource and UITableViewDataSource protocols and make it easier to migrate changes in your data views. Diffable Data Sources come with a few benefits over using the classic data source approach and are the preferred … 

 

Persistent History Tracking in Core Data

WWDC 2017 introduced a new concept available from iOS 11 which is persistent history tracking. It’s Apple’s answer for merging changes that come from several targets like app extensions. Whenever you change something in your Core Data database from your Share Extension, a transaction is written which can be merged into any of your other … 

 

withAnimation completion callback with animatable modifiers

SwiftUI is great when it comes down to animations as it does a lot for you with methods like withAnimation and animation(…). You can simply pass in the things you’d like it to animate and SwiftUI will make sure your views move smoothly from one state to another. Sometimes, however, you’d like to have the … 

 

Write-Ahead Logging (WAL) disabled to force commits in Core Data

Write-Ahead Logging is the default journaling mode for Core Data SQLite stores since iOS 7 and OS X Mavericks. Journaling in Core Data is best explained as the way data transactions are saved into the underlying SQLite store. The WAL mode is significantly faster in most scenarios compared to the previous default “rollback” journal mode … 

 

How to combine text weights in SwiftUI

Combining multiple text weights in SwiftUI might not look straight forward at first. If you’re used to using UIKit you were probably looking into support for NSAttributedString in which you could apply different text styles for certain ranges. SwiftUI makes it possible to combine different text styles with the built-in plus (+) operator implementation. Multiple … 

 

Adding a closure as a target to UIButton and other controls in Swift

The target-action pattern is used in combination with user interface controls as a callback to a user event. Whenever a button is pressed on a target, its action will be called. The fact that the method is not defined close to the control definition is sometimes seen as a downside and reason for a lot …