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”

1+

Logic of Peek and Pop in 3D Touch

TL, DR

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”

6+

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

Swifty-Klotski

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”

0

一种孤独(零)

春天一过,夏天就会马上到来。陆衍这样想着,脱掉了外套。那是一件黑色的外套,摸起来很软,他们说他穿上去会显白,像高中生。此时那件外套随意地蜷在办公桌上,在窗外阳光下像一个燥热的影子。

他现在穿的是一件白色的棉质短袖,一条深灰色的运动裤和一双橘红色的跑鞋。他看了看时间,指针在表盘上嘀嗒地走着,离下课还有三十分钟。他决定出去跑一跑。

天空的颜色是蓝的,蓝得太饱以致让人感到胀鼓鼓的疼痛。阳光被聚焦在新翻的草地上,进行着灼热的扫视。一群草籽在地皮下偷着挠痒拔节。一路跑来,草汁润湿了陆衍的鞋尖。不断地有人和他错过,喊,陆老师好!并同时留下汗味、香水味、洗衣粉味、泥土味……各种气味都沿着草尖树干、叶脉血管纷纷从世界的孔洞里跑出来,歪歪扭扭地、扶着热空气向上攀爬,然后在上面汇成一片。

Continue reading “一种孤独(零)”

5+

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 组暑假学习计划”

2+