Core Data Model Attributes and NSManagedObject Property Types Must Match!

Jump to… Data model Attributes and NSManagedObject property types – Match ’em! Optionals are Types Lessons learned Was this article helpful? Please share! Learning Core Data? Watch my course, Core Data Fundamentals with Swift! I admit – it might have taken me less time to figure out my runtime exception if I hadn’t just migrated […]

How to Unwrap Multiple Optionals with One If-Let in Swift

What do you do when you’ve got two (or more) optionals that you need to safely unwrap and work with? Code examples Suppose that you’ve got two arrays, both of which are optional. What I want to do right now is walk through a couple of scenarios where I unwrap them at the same time […]

Force Unwrapping Swift Optionals: Code Smell!

Do you find your Swift code riddled with !‘s? I’m becoming more and more uncomfortable with seeing ! throughout my Swift code. It’s just a matter of time before it’s going to bite me. Often, I do it because it’s the “easy thing” to do at the time. But it’s dangerous. Swift optionals are trying […]

Swift Optionals? Don’t Forget to Unwrap!

There is a compiler error that throws me off every time I see it.  It takes the form, ‘ClassName?’ does not have a member named ‘memberName’ This can happen when you’ve declared a variable as an optional, but forget to unwrap that optional when you attempt to call a method on it. For example, given this […]