background preloader

Swift

Facebook Twitter

"Weak, Strong, Unowned, Oh My!" - A Guide to References in Swift — KrakenDev. I often find myself worrying about retain cycles in my code.

"Weak, Strong, Unowned, Oh My!" - A Guide to References in Swift — KrakenDev

I feel like this is a common concern amongst others as well. I don't know about you, but it seems like I am constantly hearing "When am I supposed to use weak? And what the hell is this 'unowned' crap?! " The issue we find is that we know to use strong, weak, and unowned specifiers in our swift code to avoid retain cycles, but we don't quite know which specifier to use. Fortunately, I happen to know what they are AND when to use them! ARC is a compile time feature that is Apple's version of automated memory management. Strong Let's start off with what a strong reference is. Strong references are used almost everywhere in Swift.

Here is an example of strong references at play. class Kraken { let tentacle = Tentacle() }class Tentacle { let sucker = Sucker() } class Sucker {} Here we have a linear hierarchy at play. Similarly, in animation blocks, the reference hierarchy is similar as well: Weak For example, this won't compile: RemObjects Silver. RemObjects Silver is absolutely free to use.

RemObjects Silver

We're a small company. We have (and continue to) operated self-funded and self-financed for over ten years now, and we have no large backers nor millions of venture capital to finance product development, but we still do need to pay for salaries, rent, test hardware, infrastructure and many other things. We've always relied on our product revenue for these costs, so making a major new product free is a big change and a big gamble for us.

If you like Silver and believe in what we are doing with the product, we'd love for you to consider supporting its development with a small (or not-so-small) financial contribution. Any level of contribution will earn you our eternal gratitude. Swift Sandbox Newsletter - Issue 35. Welcome to Issue #35 Since the first issue of the Swift Sandbox my primary goal has been to create content that was unique across the range of Swift publications.

Swift Sandbox Newsletter - Issue 35

This has proven to be quite a challenge. Given most Swift newsletters cover topics from design to code to tutorials, I think it will be insightful to see if there is interest in a weekly newsletter which delivers on one front: links to interesting Swift open source projects. I hope you'll stick with me on this and provide your comments, feedback and suggestions. John Muchow Sponsored Link raywenderlich.com Video Tutorials. Introduction to tvOS: Building Your First tvOS App in Swift. At last month’s Apple Event in San Francisco, Apple announced the fourth generation Apple TV.

Introduction to tvOS: Building Your First tvOS App in Swift

This new update, however, is unlike any previous version of the set top box. Apple’s new TV will sport an App Store allowing users to download apps and games. Naturally, such an announcement brings a lot of excitement to the developer community. With the new Apple TV, the Cupertino based giant has introduced a new operating system, based off iOS, called tvOS. tvOS is essentially iOS but modified.

Using common frameworks and the your favorite programming language (Swift, of course!) A Beginner's Guide to NSDate in Swift. If I was ever asked what’s one of the most common stuff I do among all projects, then I would have answered that dealing with dates is definitely one of them.

A Beginner's Guide to NSDate in Swift

Undoubtably, there’s no developer out there who doesn’t really need to “play” with the NSDate class and handle dates in some manner, no matter how much or little the work on dates is. From simply converting a date value into a string up to performing calculations with dates, there’s always one constant fact: Developers have to be acquainted with this side of programming in iOS. It’s not hard to master, and eventually can lead in gaining time in other more important programming tasks. Working with dates might seem like a hassle to new programmers; however that’s not true. All you need is to get the grasp of it. The most common operation when using date (NSDate) objects in applications, is to convert them into string objects so they can be properly formatted and shown to the users.

About the Demo App The Basics. How To Stay Up-To-Date On iOS Development - Thomas Hanning. iOS development is changing very quickly.

How To Stay Up-To-Date On iOS Development - Thomas Hanning

Not a long time ago, nobody knew about Swift and size classes. Today, they are essential tools and techniques every iOS developer should know. So learning regularly is very important for every iOS developer. Using Swift with Cocoa and Objective-C: Basic Setup. Swift is designed to provide seamless compatibility with Cocoa and Objective-C.

Using Swift with Cocoa and Objective-C: Basic Setup

You can use Objective-C APIs (ranging from system frameworks to your own custom code) in Swift, and you can use Swift APIs in Objective-C. This compatibility makes Swift an easy, convenient, and powerful tool to integrate into your Cocoa app development workflow. RW-Swift-Cheatsheet-0_5.pdf. Swift Quick Syntax Reference. Swift - Resources. Swift Blocks Tutorial - Swift Closures. In iOS Swift Blocks (Closures) Tutorial, I have explained about iOS Swift Closures (Blocks) syntax, features and usage with examples.

Swift Blocks Tutorial - Swift Closures