Victor S. Wang
user

Victor S. Wang

My Blog


Featured

Swift

Two weird things about protocol, extension and subclass in Swift

Posted on .

As I wrote a post about method dispatch in Swift yesterday, in the meantime, I found there are two weird problems.

Tested with Swift 2.1 & Xcode 7.2

The first one is the behaviors of overriding extension method are weird. It seems that we can only override the methods in extension which is full compatible with Objective-C. Otherwise we’ll have an compile error: Declaration from extensions cannot be overridden yet

Featured

Swift

Method dispatch in Swift with protocol, protocol extension, extension and subclass

Posted on .

The protocol extension introduced in Swift 2.0 is certainly a powerful tool, meanwhile things are also becoming more complex. Alexandros Salazar has wrote a post “The Ghost of Swift Bugs Future” to discuss it. There is also a Flow Diagram made by Omar Abdelhafith which showing how the methods dispatch works in Swift.

In this post, I try to discover a little bit more in case there is an extension or a subclass.

Tested with Swift 2.1 & Xcode 7.2

First of all, let’s replay the conclusion of Alexandros.

Featured

Swift

The answers - Quizzes about properties in Swift

Posted on .

Before get into the answers, you may want to checkout the quizzes from HERE

Featured

Swift

Quizzes about properties in Swift

Posted on .

Come on, I know you guys love both Quiz and Swift. This post brings you some quizzes about properties in Swift, try to tell the answer without actually run it, could you get them all ? Just try it.

The quizzes may be easy for some of you, may be not. The most important thing here, I hope you guys all have fun from it, cheers 🎉🎉🍻

Featured

Tools

Run your code snippet in Xcode without building the whole project

Posted on .

This blog post is posted on Medium. Please checkout The link of this Blog on Medium