LoginSignup
14
14

More than 5 years have passed since last update.

Swiftでファンシーなコードを書いてみた

Last updated at Posted at 2014-07-21

Swiftでは、日本語や絵文字を含むほぼどんな文字でも変数名に使用可能です。
これを利用して、ファンシーなコードで簡単な占いアプリを作ってみました。

スクリーンショット 2014-07-21 18.50.27.png

機種依存文字を使用しているため画像で表示します。

実用性はともかく、子供向け、あるいは入門用としてこういうコードを書くのもありかなと思います。

ただ、Swiftでは厳密に同じ型でないと四則演算ができないようで、型変換が少々面倒くさいですね。

ダウンロードは以下からどうぞ。
https://github.com/yukinaga/FortunetellingWithSwift

また、同じコードをObjective-Cでも書いてみました。比較のためにどうぞ。
https://github.com/yukinaga/FortunetellingWithObjC

14
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
14