Tech

  • Posted on

    Create custom Xcode templates

    Everytime we create a new file, Xcode suggests some built-in templates that may be useful. Luckily, we could also create our own templates. Technically, Xcode looks for templates in ~/Library/Developer/Xcode/Templates and /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates. Let’s call the first path P1 and the second path P2. A template could be iferred by a folder MY_TEMPLATE.xctemplate. Assume we gonna create a template for MVVM. It should create 3 files: [Feature]Model.swift, [Feature]ViewModel.swift and [Feature]ViewController.swift. Ex: LoginModel.

  • Posted on

    FAQ on ReactiveCocoa

    This post highlights some Q&A related to ReactiveCocoa - a FRP framework specifically built for iOS.

  • Posted on

    Garbage Collection (GC) algorithms

    As an iOS developer, I am quite familiar with Reference Counting. It is considered a fundamental knowledge regarding memory manangement that every iOS developers must acknowledge. Today, I figured out a few more algorithms of garbage collection. Fig 1. From left to right: Reference Counting, Mark-Sweep, Mark-Compact, Copying. Reference Counting (RC) This is simple & easy to implement. However, it has some major drawbacks one of which is not being able to deal with retain cycles.

  • Posted on

    Swift: ExpressibleByStringLiteral

    It is a protocol in Swift 3 (which was StringLiteralConvertible in Swift 2). The name clearly reflects the meaning that an object of a class can be expressed by a literal string

  • Posted on

    Log events in ReactiveCocoa

    I used to spend a lot of time reading documentations of ReactiveCocoa (Framework overview, design guidlines, basic operators…) but, unfortunately, missed this one…

  • Posted on

    A freestyle way to config UIView

    This article is to introduce a freestyle way to set up views in iOS (by code).

  • Posted on

    Swift: Generic protocol (p.1)

    In this article, we would look into how to implement a generic protocol. A few lacks of language support (Swift version prior to 3.0) would be also pointed out for discussion.

  • Posted on

    Swift: Concrete types in Protocol

    A specific use case that we are unable to use concrete types in protocol, and how to fix it.

  • Posted on

    Swift: Currying

    This topic has been mentioned as a part of Functional programming. Though it’s kind of fun to use currying, we often see it on the list along with functors, applicative, monads… In this article, I’ll show you a couple of ways to have fun with currying.

  • Posted on

    Swift: Optional — map

    A few experiments with optionals in Swift.