Clicky

iOS Dev Nugget 187 Creating a Singleton Class in Swift

.

Need to run a code review on your codebase? Hire me

I'll be covering a few common "patterns" in future issues, especially in Swift. Let's start with something simple — creating a singleton in Swift:

class MyClass {
    static let sharedInstance = MyClass()
}

You can access it with:

MyClass.sharedInstance()


Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No

.

.

Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter

.

View archives of past issues