Posts

Xcode 11 Features

Image
Some of the XCode 11 features are: SwiftUI Minimap Rich Documentation Swift Package Manager Inline Diff Transform iPad Apps to Mac Debugging and Simulators Let’s look into each of these one by one. 1. SwiftUI SwiftUI is the big announcement this year. It’s a new framework introduced for easily creating layouts using swift code. Moreover, Xcode shows us a real app like interface viewer side by side while you edit the Swift file. It requires a Declarative syntax which is easy to use Swift code. Adding animations and stuff is all very easy. Xcode 11 Swiftui This is a major shift from the Storyboards and drag and drop setup. The only issue: SwiftUI is available from iOS 13 and above. It is not backward compatible with the current old iOS versions. Hence use it only if your app supports iOS 13 and above. To use SwiftUI, select the toolbox from the project setup window as shown below: Xcode Swiftui Setup 2. Minimap Xcode has an awesome looking minimap of your code at the left. You can quickl

Setup React Native Environment in Mac for iOS and Androd

Image
Step 0 — Install  npm and node.js Go to the node.js website ( https://nodejs.org/en/ )and install  node.js . npm is distributed with Node.js which means that when you download Node.js, you automatically get npm installed on your computer. npm is a package manger for JavaScript programming language, and the default package manager for Node.js Javascript runtime environment. Step 1 — Install Homebrew Open your terminal and run the following code to install  Homebrew  − /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" If for some reason copying and pasting the above didn’t work, please go directly to the  website  and copy and paste the command/code from there. Step 2 — Install Watchman Run the following code to install Watchman. brew install watchman Step 3 — Install React Native Now, run the following code to install React Native. sudo npm install -g react-native-cli Step 4 Android — Install Android S

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