LoginSignup
8
9

More than 5 years have passed since last update.

iOS Widget導入の準備メモ

Last updated at Posted at 2015-02-19

SnapDishにWidget機能を追加することになったので開発することになった。やったこと忘れそうなので記録することにした。現在、本体はObjective-Cで開発されている。今回は、Swiftもやりたいので、初めてのSwiftプロダクション利用だけど、やらないと始まらないのでSwiftでやることにした。

File>New>Targetを選択

Screen Shot 2015-02-19 at 2.01.43 PM.png

Today Extensionを選択してNext

Screen Shot 2015-02-19 at 2.03.52 PM.png

Product Nameを指定する

Screen Shot 2015-02-19 at 2.06.11 PM.png

今回は、SDWidgetを指定する。これはデフォルトのWidget表示名前になるので、後ほどinfo.plistでWidgetの表示名を修正する。

左のナビゲーションに以下が追加される

Screen Shot 2015-02-19 at 2.11.33 PM.png

開発用とAdHoc用のプロパティリストを追加

*必要でなければやらなくてよい

Supporting Filesを選択

Screen Shot 2015-02-19 at 2.17.07 PM.png

File > New > Fileを選択

Screen Shot 2015-02-19 at 2.15.40 PM.png

Property Listを選択

Screen Shot 2015-02-19 at 2.18.42 PM.png

開発とAdHoc用のInfo.plistを作成

Screen Shot 2015-02-19 at 2.20.06 PM.png
Screen Shot 2015-02-19 at 2.20.22 PM.png
Screen Shot 2015-02-19 at 2.21.51 PM.png

Info.plistの設定する

表示名とBundle identifierを指定する
Screen Shot 2015-02-19 at 2.24.20 PM.png
Screen Shot 2015-02-19 at 2.25.29 PM.png
Screen Shot 2015-02-19 at 2.25.44 PM.png

ビルドのSchemeに対応するplistを指定する

Screen Shot 2015-02-19 at 2.29.20 PM.png

アプリをコンパイルして動作の確認をする

iOS Simulator Screen Shot Feb 19, 2015, 2.35.34 PM.png
iOS Simulator Screen Shot Feb 19, 2015, 2.35.46 PM.png
iOS Simulator Screen Shot Feb 19, 2015, 2.35.52 PM.png
iOS Simulator Screen Shot Feb 19, 2015, 2.36.06 PM.png

まとめ

比較的簡単に準備ができた。SnapDishで投稿された人気の料理写真を表示させる実装を行うことにする。

開発に関してはこちら

8
9
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
8
9