Xcode And Spm

Here is how you use Swift package manager in your XCode app projects

Carthage And Nested Frameworks

A few workflows concerning Carthage and nested framework

Two Finger Swipe

Notes on implementing two finger swipe for macOS

Switch

Notes about the Switch component

Playground And Framework

Notes on adding external .framework files to playground.

Swift Package Manager

Notes on Swift package manager

Cocoapods

How to Use CocoaPods with Swift

Semantic Versioning

My notes on Semantic Versioning

Carthage

My notes on Carthage

Parsing Dates With Reg Ex

Some RegEx examples

Framework

Some notes on swift .framework

Swift 3 Migration

After manually migrating 35.000 lines of swift 2.2 into swift 3.0 code.

Background Thread

UI on the Main-thread everything else on a background thread

Dictionary Reflection

Reflection and UnWrapping now has Dictionary support

Binary Search

Binary search implementation in swift

Nstask

NSTask lets you run command-line calls in your app

Git Log

Notes on different log outputs that Git provides

Git Workflows

Overview of basic Git workflows

Git Resources

A collection of Git learning material

Git Concepts

Overview of basic git concepts

Git Commands

Overview of basic git commands

Creating An App Icon

Creating an app icon that can be use for macOS apps

Hashing With Hashable In Swift

Example of hashing with swift: (The idea is to store Styles in a hash and see if performance goes up)

Circle Tangent To 3 Lines

Fitting a circle Given 4 points. p1, p2, p3, p4

Dynamic Method Call

Reducing for-loops is a great way to maintain readability and maintain code modularity. “Data science” methods like map, flatMap, filter and reduce are awesome building blocks for functional programing in swift, but you can also build your own custom methods that do similar things.

Basic Xml Parsing

Basic XML parsing in swift (Mac):

Programatic Nsmenu

Creating a Programatic NSMenu

Enumerating Cg Path

Research on Parsing CGPath

Sorting

Sorting things in swift

Live Edit

In its simplest form you click a button and it loads a css and recursively calls setSkin on the UI.

Encode Decode

Encoding and decoding of text

Shell Testing

Some shell research

Singleton In Swift

Examples of singletons

class SingletonA {
    static let sharedInstance = SingletonA()
    init() {
        println("AAA");
    }
}

class TheOneAndOnlyKraken {
    static let sharedInstance = TheOneAndOnlyKraken()
    private init() {} //This prevents others from using the default '()' initializer for this class.
	func test(){
		print("hello world")
	}
}


let singleton = TheOneAndOnlyKraken.sharedInstance
singleton.test()

Another singleton example:

// Creating our Singleton

class Manager {
    // Declare our 'sharedI' property
    static let shared = SomeManager()

    // Set an initializer -
    // it will only be called once
    init() {
        print("SomeManager initialized")
    }

    // Add a test function
    func doSth() {
        print("I'm doing something")
    }
}

// The 'init' function will
// only be called the first time
Manager.shared.doSth()

Cvdisplaylink

CVDisplayLink is a timer object that allows your application to synchronize its drawing to the refresh rate of the display. ==It’s highly useful when you want to combine animation with user interactions==, something that is not easily handled by transitions or stock animations.

Core Animation

My Research-notes on core animation

The Event System

A simple event system that propagates events through hierarchical classes

Gesture Research

Notes on gestures

Hit Testing Sub Views

Researching hit-testing of sub views

Asserting Class And Protocol

Great method that asserts if an instance is of a class type or of a protocol type

Chromeless Window

Customize a window with any design and behavior, everything is also animatable.

Calayer Implicit Animation

My notes on implicit animation

Swift Regex Has No Conditional Backref

When you want to assert if a digit is a digit i used to use a simple conditional back referencing pattern.

Graphic Framework For Osx

A graphics framework built on Quartz

Dynamic Instance Creation

NOTE: it does require that each class extends the same protocol and that they have similar init method

Equality Between Protocols

Drop this in playground and your on your way:

Extracting Rgba Values From Nscolor

Extracting RGBA values from NSColor

Casting Arrays

**Casting Array to Array**

Printable Classes

This is a great way to add context to “data container classes” as it is then easy to debug all the variables in the instance

Equatable Protocol

My notes on the Equatable protocol in swift

Hand Cursor On Hover

Drop this code into any subclass of NSView, to enable the hand cursor