Last year, I wrote about the difference between private and fileprivate in Swift 3. With the impending release of Swift 4, it’s time for an update. Access control underwent several important changes since the introduction of the Swift language, several years ago.
Last week, I wrote about weak and strong outlets. But there’s another question about outlets that comes up frequently. Should outlets be declared as optionals or implicitly unwrapped optionals? This tutorial zooms in on the pros and cons of each of these options.
If you’re reading this, then I assume you’re familiar with Swift extensions. A Swift extension allows you to add functionality to a type, that is, a class, a structure, an enumeration, or a protocol. But extensions are more powerful than that. In this tutorial, I’d like to show you four clever uses of Swift extensions.
If you’ve been paying attention, then you may have noticed that we haven’t resolved the strong reference cycle of the Device class. Remember from earlier in this series, this is what the Device class looks like.
In yesterday’s installment of Understanding Swift Memory Management, you learned how weak and unowned references can be used to break a strong reference cycle. It’s time to take a closer look at what sets weak and unowned references apart from strong references. We also revisit weak and unowned references. What is the difference between weak and unowned references? When is it appropriate to choose an unowned reference over a weak reference?
Strong reference cycles can cripple your application. In this article, I show you how to resolve the strong reference cycles we created in the previous installment of this series.
In the previous installment of this series, you learned about Automatic Reference Counting and how it helps keep memory management in check. Remember that a class instance is deallocated if no properties, constants, or variables hold a strong reference to the class instance. I didn’t explain what a strong reference is, though.
Before we can discuss Automatic Reference Counting, ARC for short, you need to understand the difference between value types and reference types.
Earlier this week, I showed you how to create a custom control using a bitmask. But it’s time to take it one step further by adding RxSwift to the mix. In this tutorial, we make the custom control we built reactive using RxSwift.
This tutorial has been updated for Xcode 8 and Swift 3. Control flow is an essential aspect of any programming language. In this and the next lesson, we discuss loops and conditionals. We start with conditionals.