Using CAShapeLayer to draw a circle

UIViews are like Ogres, which are like onions – they have layers. Source: Documentation More accurately, UIView has a single layer property that can have infinite sublayers. UIView’s have layers Lets draw a circle. First create a UIView and a CAShapeLayer: let myView = UIView() let myLayer = CAShapeLayer() Layers have a path UIBezierPath makes drawing shapes…

iOS Application Lifecycle – UIKit basics

iOS applications are all about cycles This is because the iOS applications are richly interactive when it comes to user input and much of your programming with UIKit will be delegate oriented. Knowing the many different “cycles” of the device and application will be illuminating for your development. States of the UIKit App Cycle * These are the…

iOS without storyboard

Why? Programmatically/Code or NIB based layouts are a much better fit for projects that use version control (see merge conflicts) and make it much easier to reuse views. If you are deciding not to use storyboards, you will need to manually set your application window to your desired UIWindow Prerequisites: – Delete Main Interface from Deployment…

Forgetting to set translatesAutoresizingMaskIntoConstraints to false

UIKit on iOS is great! There are tons of tools and often this can supercharge your productivity for getting a prototype out into the world. Additionally, working with AutoLayout programmatically can be great if you avoid these rookie mistakes. Rookie Mistake 1: It hurts when you spend hours dealing with the rookie mistake of forgetting to…

Delete files by filename with “find”

When you upload photos multiple times, the computer can start numbering the photos. IMG_A becomes IMG_A 1 and IMG_A 2 and IMG_A 3. Using a wildcard * and specifying the ending space and number will help you select the files. For example: Find all the files that end in “space”1.JPG find -name ‘* 1.JPG’ * Have a look at the…

Setting environment variables

How to see and set your environment variables Print all your current environment variables with  $ printenv See a the value for a specific variable with echo $ printenv <YOUR_VARIABLE> or $ echo $<YOUR_VARIABLE> For example: $ printenv MY_API_KEY or $ echo $MY_API_KEY How do I set the variable temporarily? This will set your variable for ONLY…

Levels of installing python

This is an opinionated route towards python management. Every computer may have its own set up. Level 0: “I just want to play with python” Method 1: Use and online REPL like this: https://repl.it/languages/python Level 1: “I want python on my computer” Download brew, use brew to download the latest version of python and go crazy.…