chevron-up bell reply instagram twitter2 feed3 finder search-25px-p0

Category Archives: iOS

iOS Unit Test Practise with OCMock 2/3

The idea behind Mock: Using a fake object to simulate target object, a method returned value/object. For example, there might be an amount of classes including models, viewControllers and etc. With regular unit tests, we need to instantiate the objects that we are going to test……

A comparison between Kotlin and Swift: Collections

Similar to Swift, collection in Kotlin includes: List Set Map 1. List Features of List: May have duplicate element May hold different data types All elements are unordered Similar to array in swift, list can be immutable and mutable. With immutable list, it can't be added……

Optional in Swift (Easy Start with examples)

Optional in Swift Swift is designed as a type Safe language. With the introduction of Optional, Swift solved the issue that variable can be nil or not in Objective-C, which makes the code more robust and safe. Optional is like a box, you can put normal type (Int, String, object……

Selector in Objc/Swift

In this short article you will know: Selector in Objc Selector in Swift Passing value using Selector Selector in Objc: Selector is a concept of Objective-C Runtime, which allows to turn a method's name (NSString) into a SEL type. Basically you cand find @selectoreverywhere, s……

Runtime in Objective-C

Objective-C is a dynamic language. With Runtime, objects can be represented through struct in C, and methods can be done via c language function. Runtime is written in assembly and c. With the benefits of Runtime, we have another way to call class and instance methods. The foll……

Singleton in Objective-C/Swift

What is behind the Singleton? Singleton: Instantiation of a class to ONLY one object Features of Singleton: One class only can have only one instance; It must can create this instance automatically; This instance must be provided to other objects. Benefits of Singleton: All o……

Key-Value Coding and Key-Value Observing in Objective-C

What is KVO/KVC KVC(Key-Value Coding) is a coding style which coming from Functional Programming, KVO(Key-Vlaue Observing) is the technology that underlies Cocoa Bindings, and it provides a way for objects to get notified when the properties of other objects are changed. How do……