Hi, there! This is the second Swifty Week post. So far I don’t know how many people are looking forward to seeing the article in the #swiftyweek, but I’ll continue to wrap up an interesting topic. After finishing the first article in #swiftyweek, I came to feel like learning something more than usual.

Surprisingly, I could find many users from Russia by analytics :grin:


Date Math is Hard, Let’s Do it Tomorrow

[NS]Calendar is your friend and will gladly help you out here. In iOS 8 it gained a bunch of useful new methods, too, so I recommend looking closely at the docs.

If you work on a global app(or it has complicated date and time calculations), you should check the article! In my opinion, a test is really important in Date and Time.


Today’s goal: understand collection types in Swift a little better. I wanted to start with the simplest one in the standard library: CollectionOfOne. As the name suggests, this is a collection that holds a single element. … You can gain some efficiencies by using CollectionOfOne instead of a full-blown array.

This is the explanation of CollectionOfOne that is the simplest one of collection types in the standard library. If you interested in the more details, you can check the full source code.


There’s one more important thing you can do with collection types: iterate over them. CollectionOfOne has a corresponding IteratorOverOne that we’ll dig into for this short follow-up post.

This is the next version of CollectionOne. If you like the above article, you’ll be fond of IteratorOverOne. Thanks to protocol extensions, these protocols can get many methods and properties for free.

Paleo App Dieting

No doubt you’re aware that bigger is not better for downloads on the App Store, especially if you hit the dreaded 100 MB cellular download limit, but were you aware that even if you haven’t there’s a marked disadvantage to download size increasing? Well, here it’s quantified by way of Actual Real Life Experiment

If you have a mission to reduce the app size capacity, I recommend to seeing this!

Why Swift is swift

Swift can speed up dynamic dispatch from Objective-C by using vtables because it has this type safety where when you instantiate something, it’s either a parent or a subclass of that.

To digging into an internal Swift is really fun.

Refresh Control Changes in iOS 10

Apple first added the pull-to-refresh style user interface control way back in iOS 6. Unfortunately it only worked with a table view controller. You were out of luck if you wanted to use it with a plain scroll view or collection views. After a long wait Apple enthusiastically announced at WWDC 2016 that iOS 10 was bringing refresh controls to the scroll view and by inheritance to table and collection views. This post walks you through what you need to know.

I know the fact, but I never tried a refresh controls in the scroll view in iOS10. Looks good :+1:

The RawRepresentable Protocol in Swift

The raw value syntax for enums in Swift is “just” a shorthand for conformance to the RawRepresentable protocol. It’s easy to add this manually if you want to use otherwise unsupported types as raw values.

Typed Notifications (Part 1)

We build a lightweight generic wrapper around Foundation’s notification API. This allows us to abstract away common boilerplate code and to work with a type-safe interface.

Their way is really cool. I’m looking forward to the next part.


With iOS 10 came a bunch of new interesting features, like the UIViewPropertyAnimator, a brand new class that improves animation handling. The view property animator completely changes the flow that we are used to, adding a finer control over the animations logic.

I didn’t catch up the animation API around UIViewPropertyAnimator. It’s time to learn.

Testing Without Xcode: It’s Everywhere You Want to Be

Now that Swift is available on many platforms, how can developers use testing frameworks outside of Xcode to their advantage? In this CMD+U Conference talk, Kyle Fuller discusses a variety of possible approaches.

bliki: FunctionLength

Small functions like this only work if the names are good, so you need to pay good attention to naming. This takes practice, but once you get good at it, this approach can make code remarkably self-documenting. Larger scale functions can read like a story, and the reader can choose which functions to dive into for more detail as she needs it.

It’s not related to Swift directly. But it worths reading for me.



Key-Value Coding (KVC) for native Swift classes and structs

pixyzehn/EsaKit (Actually, I made it :star2:)

A Swift framework for the esa.io API https://esa.io/


App version of Refactorator plugin


A personal weather app I’m building in the open.

I think this is a good example of using IGListKit.


Talking and Teaching

I don’t know how it is for most speakers, but for me, preparing a talk is very difficult. It took me nearly five months to develop my talk for try! Swift. I completely rewrote it four times and practiced it for weeks.

Five months :scream:

Get Your Apps Ready for the Holidays

Don’t forget the news :dash:

Finally, I found a really cool Podcast called More Than Just Code Podcast. If you like like this kind of Podcast, see the my list.

Unfortunately, iOhYes that is the one of my favorite Podcasts finished recently :cry:

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