Machine Learning in iOS

Part 1: Freud the Swift ML Library

Part 2: Core ML, Shazam for Images

Pt. 1: Freud the Swift ML Library

Freud is a Swift (3) machine-learning library dedicated to Sigmund Freud. This Library is implemented under the ‘Ego’ philosophy.

The ego attempts to mediate between id and reality.

Swift has been my favorite programming language of all time since the day Apple released it and playing with Swift is my daily joy. Last year when I was browsing GitHub I came across  this project Swift AI by Collin Hundley and decided to try it out because everyone is crazy about it. Later I found out that Swift AI is in Swift 2.2 and by then Swift 3 had been out for months already. I could not compile it of course.

Everyone knows Xcode was not good at converting Swift 2 to Swift 3. Given that Xcode converting and minor modifications on the code would not work at all, I decided to rewrite the Swift AI project in Swift 3, and that’s why Freud is here.

And I know Swift 4 is out here now so I’m now doing some converting work.

Continue reading “Machine Learning in iOS”


Logic of Peek and Pop in 3D Touch


In 2015 Apple introduced 3D Touch. Before that there was already Force Touch on Apple Watch and MacBook Pro. Although both “touch” are techniques that make the touchscreen force-sensitive, 3D Touch on iPhone 6s / 7 are in a way of a higher dimension. 3D Touch is sensitive to continuous force changes, while Force Touch is discrete. With 3D Touch coming with new iOS devices, UIKit evolved too. A new way of interaction was introduced, which we’re going to talk about, that is, Peek and PopLet’s see how Apple defined Peek and Pop in its official guidelines:

Peek and Pop let your users preview all kinds of content and even act on it — without having to actually open it. Users can then press a little deeper to Pop into content in your app.More specifically:You can now enable the view controllers in your app (instances of the UIViewController class) to respond to user presses of various intensities. As the user presses more deeply, interaction proceeds through three phases:

  1. Indication that content preview is available
  2. Display of the preview—known as a peek—with options to act on it directly—known as peek quick actions
  3. Optional navigation to the view shown in the preview—known as a pop

Continue reading “Logic of Peek and Pop in 3D Touch”


Swifty-Klotski, an iOS Game with an AI Built in


A Klotski game with a powerful searching AI built in, completely implemented in Swift.

About Klotski

Klotski (华容道 in Chinese), is a sliding block puzzle with special layouts of 10 different blocks and the aim of Klotski is to move a specific block, aka, CaoCao, to some predefined location.

We built Swifty-Klotski in which an AI can automatically search for feasible solutions to a layout.

Interpreting the Puzzle in Math

Coordinate Mapping.

Mapping Layouts to a Coordinate System

Klotski has a 4×5 board with 10 different blocks at different positions. We mapped the board to a simple coordinate system, making it easy to represent different layouts using xAxis and yAxis values.

Continue reading “Swifty-Klotski, an iOS Game with an AI Built in”






Continue reading “一种孤独(零)”


Users who have LIKED this post:

  • avatar

iOS 组暑假学习计划

暑假的学习主要集中在新语言、iOS SDK 的学习、已有项目的阅读

  • Swift 3.0
  • 「微北洋」 /「 问津」 源代码
  • KVO
  • M-V-C
  • 3rd-Party Repositories on GitHub


#Swift 3.0

Swift, an Open Source Language

Swift 是 Apple 为了取代 Objective-C 而开发的语言,不同于 Objective-C,Swift 是完全开源的,目前可以在 OS X 和 Linux 内核操作系统中编译与运行。「微北洋」与「问津」目前都在逐渐转向 Swift 开发。Swift 实战演练将是我们暑假学习计划的核心。

Continue reading “iOS 组暑假学习计划”