Posts

Weak vs Strong Unowned in Swift

Image
I often find myself worrying about retain cycles in my code. 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! I hope this guide helps you to learn when and where to use them on your own. LET'S GET STARTED ARC ARC is a compile time feature that is Apple's version of automated memory management. It stands for  Automatic Reference Counting.  This means that it  only  frees up memory for objects when there are  zero strong  references to them. STRONG Let's start off with what a strong reference is. It's essentially a normal reference (pointer and all), but...

Need a Facebook App ID before you create a new project with the SDK.

Image
You will need a Facebook App ID before you create a new project with the SDK. 1 . Create a new app on the  Facebook App Dashboard , enter your app's basic information. Once created, note the app ID shown at the top of the dashboard page.  Alternatively, you can of course use the ID of an existing app. Now, you need to set the Bundle Identifier and configure your Facebook application to support login from an iOS application. (Note: this is a new step in the Facebook SDK for iOS v3.1. Previous versions of the SDK did not require this step.) Click on the checkmark next to “Native iOS App” and supply your Bundle Identifier in the “Bundle ID” field. In addition, make sure the Facebook Login radio button is set to “Enabled”. You can find or set your Bundle Identifier in Xcode in the Project tab. 3. Configure a new Xcode Project Create a new Xcode project, add the Facebook SDK for iOS, its dependencies, and the Facebook App ID to its settings In Xcode, create a new pr...