This is the #10 article. I finally reached two digits. Today, I released a new simple app called Kigen(期限): Todo List for reminder. The main purpose is to learn MVVM pattern with Realm, so don’t expect awesome application:(
See also Kigen: Todo List for reminder. But I really like creating a simple and minimum app because I can focus on a quality of code and a technical problem.

iOS 10.3 comes out :tada:
New Beta Downloads are here.

If you’d like to see markdown, you can look at here.



Article

Open Sourcing Bluepill: Run iOS Tests in Multiple Simulators

Testing is a key component of LinkedIn’s 3x3 strategy. As we continue improving our iOS continuous delivery pipeline, we are faced with two major obstacles—tooling stability and scalability. We needed a tool to run iOS UI tests both reliably and quickly. For this reason, we created a project, called Bluepill, that we are open sourcing today. Bluepill is a reliable iOS testing tool that runs UI tests using multiple simulators on a single machine. Bluepill has saved LinkedIn thousands of developer hours, and we believe it can also provide a great benefit to anyone running iOS UI tests at scale.


How to read Standard Input in Swift

I have been working on HackerRank challenges recently. Most of questions require me to read input at the beginning. Input is usually read from standard input. It’s not necessary to use standard input with the usual iOS development, so some people might not know how to do it. I want to share how to do it this time.

It’s handy for a programming contest.


HOW TO KEEP YOUR STYLE CODE CLEAN IN SWIFT

The generic Style class is reusable and makes your view code reusable. It is concise and easy to understand at the call site, as well as in the app-specific Style extension. The app-specific Style can also be tweaked easily without needing to change code anywhere else in your app, and makes questions like “What if we made the titles bold and one point bigger?” or “Can we change all of the buttons to blue?” much less terrifying.


Locating the source of a memory leak.

I also want to mention that you should turn this option on and off when you debug memory leaks. When Malloc Stack Logging is turned on, some properties aren’t logged fully when stepping through with the debugger, which can make it difficult to debug your code.

About Malloc Stack Logging. This article is supplementary information of memory leaks article by Emilien Stremsdoerfer.


Pretty much every way to assign optionals

  • Store a non-optional or an optional to an optional
  • Store an optional to a non-optional
  • Update optional only if optItem is non-nil
  • Update optional only if optItem is nil
  • Update optional only if new value is non-nil

One interesting solution for ‘Update optional only if optItem is non-nil’ is

optItem? = nonOptionalValue


What’s new in Swift 3.1

Swift 3.1 is a small, backwards-compatible update to Swift 3.0, cleaning up a few advanced features in preparation for more serious changes coming when Swift 4.0 is announced in June. Although it took a lot of behind-the-scenes work to make these changes happen (see here and here if you’d like some detail), the end result for developers is a few extra features that we’ll be able to start using soon enough. In this article I’m going to explain three of the most useful changes with code examples, and hopefully this will give you some chance to be prepared to update your code when the time comes.


Pushing the limits of protocol-oriented programming

All programming languages have their own “personality” and encourage certain paradigms. In Swift, this is expressed through protocols and a focus on value types. As a community, we convey this by describing code as being “swifty” or not. In this talk, we’ll examine how we can push the limits of protocol-oriented programming (and thus, the limits of the Swift type-checker) by building a generic, protocol-oriented (“swifty”) data source framework.


Waiting in XCTest

Waiting is hard, and waiting in Xcode is no exception. Even choosing from the myriad of options Xcode and XCTest provide can be difficult. Read on to learn an easy and straightforward approach to waiting for expectations with new classes introduced in Xcode 8.3.


(dotSwift) Search GitHub with RxSwift

In my talk at dotSwift 2017 I start with generic overview of some of the RxSwift basics and move to three complete code examples. In three posts I’ll post the sample code and comment shortly why I chose to highlight these exact examples. Let’s start with number one.


Framework Oriented Programming and It’s Relation to OOP

frameworkoriented.io hosts a text on “Framework Oriented Programming” (FOP). That title already looks similar to “Object-Oriented Programming”. But it’s not a replacement, mind you; it surely means the same for our cause as Cocoa UIKit/AppKit developers. The shift in perspective from object to framework works very well to illustrate the problem of designing large code bases.


Faster Mix-and-Match Builds with Precompiled Bridging Headers

An examination of build times of Xcode projects that mix Objective-C and Swift, which can contain large bridging headers, shows that the Swift compiler spends a lot of time re-processing the same bridging headers for all the Swift files in a project. In certain projects, each additional Swift file increases the overall build time noticeably, even when the Swift file is quite modest. This post will discuss this compile-time cost, and how it is being addressed in Swift 3.1.


Fun with String Interpolation

It’s really cool that Swift makes this possible, even if the API is far from perfect. When the string interpolation API gets revamped in a future Swift version, it will likely become even more expressive and hopefully easier to use.


Swift Idioms

  • Leverage Libraries
  • Embrace Generics
  • Consider Protocol
  • Live Functionally
  • Avoid Global Functions
  • Think Tests and Documentation
  • Prefer Good Swiftsmanship
import Foundation

extension Array where Element: Hashable {
    func mode() -> (item: Element?, count: Int) {
        let countedSet = NSCountedSet(array: self)
        let counts = countedSet.objectEnumerator()
            .map({ (item: $0 as? Element, count: countedSet.count(for: $0)) })
        return counts.reduce((item: nil, count: 0), {
            return ($0.count > $1.count) ? $0 : $1
        })
    }
}

print([1,5,3,4,2,5,5,6,7,5,10].mode()) // => (Optional(5), 4)



Slide

Want to get started with Firebase Dynamic Links on iOS? Well, you’ve come to the right place!


Testing an Untested App

In this CMD+U Conference live coding demo, Michael May shows techniques for starting to test code which has no existing tests.


Swift Enums & State Machines

Christina Lee at Swift Summit in San Francisco, 2016


[Objective] C++: What Could Possibly Go Wrong?

Considering the “beautiful madness” of Objective-C++, Peter Steinberger looks at the situations where it’s a great tool to use, those where you really shouldn’t, and how to avoid shooting yourself in the foot while trying. For example, did you know that modern C++ has its own version of ARC, weak, and blocks? We learn to identify common performance bottlenecks, and focus on a small subset of C++ that will be an immediately useful addition to your toolbox.



Github

futurice/ios-good-practices

Good ideas for iOS development, by Futurice developers. http://www.futurice.com

Jintin/Swimat

An Xcode formatter plug-in to format your swift code.

jakerockland/Swisp

A simple Scheme (Lisp dialect) interpreter written in Swift.

wayneashleyberry/wunderline

A command-line client for Wunderlist, the easiest way to get stuff done. https://git.io/vM45l

Also, web site is here. wunderline

crsmithdev/hint

A simple mindfulness reminder for macOS

icanzilb/RxSwiftoniOS

Sample code from my dotSwift 2017 talk in Paris



Random

The Practice of Programming: 18 Years Later

Over the new year holiday time I had a chance to get away from it all, and snuck up to Finland to sit in a lodge on the Gulf of Finland, sip coffee, take saunas and read. I brought along a few books, the only programming one being Brian W. Kernighan and Rob Pike’s “The Practice of Programming.”


Progressive Disclosure In Swift

In his excellent interview with the Accidental Tech Podcast, Chris Lattner defended the goal of Swift being suitable to both beginner and advanced programmers. He cites progressive disclosure, a design philosophy that is often employed in GUI applications, to make otherwise intimidating interfaces appear approachable.


Let Your Side-Project Backlog Spark Joy

Living in anticipation is actually a way of extending joy, because it gives you something to look forward to. So instead of thinking of my project backlog as something to catch up on or as this gap between where I am and where I should be, I instead try to think of it as a list of all the potential I have in front of me.


Superhuman Developers, Decision Fatigue and Procrastination

So, you’re a finite resource. What can you do to manage that?

  1. Pick a task to focus on
  2. Just start it, even if you don’t know where you are going yet
  3. Take motivation by focusing on what you’ve accomplished
  4. Choose your commitments wisely


5 Core Swift Competencies Before You Get a Job

I recently started the process of interviewing candiates for a new Swift/iOS developer position at my dev shop. I have been preparing to administer some tech interviews which led me to down the path of deciding what skills I need in a candiate. I am not particularly concerned that they know every technical detail, especially if they are new. I imagine most developers will be able to tackle any problem I give them, in time, using the vast amount of resources out there now to point you in the right direction when you experience a problem. The knowledge I want is that which is not a requirement to get the job done, but to get the job done reliably well. I want real developers, not people who simply puzzle solutions together (even though I think the puzzling step is important). Therefore, I came up with 5 different knowledge sets that I think separate the developers from the puzzlers.



Podcast

Transcript of episode 205, an interview of Chris Lattner on January 17, 2017:

Transcript of episode 205, an interview of Chris Lattner on January 17, 2017:


37: Chris Lattner - Creator of Swift

Chris Lattner!!! Can you believe it?



If you have any questions and feedbacks about a kind of new Swifty week, feel free to ask me :+1: You can catch me on Twitter and Github.

Have a lovely week <3