LoginSignup
1
1

More than 3 years have passed since last update.

R.Swift使い方 備忘録

Last updated at Posted at 2020-08-14

画面遷移を簡潔なコードのみで実行してくれるライブラリ
R.Swiftの使い方について
自分用メモ

1、cocoapodからR.Swiftをインストール

pod "R.swift"

2、R.swiftのセットアップ方法(Swift5)これを参考に設定をする

Run Scriptは「[CP] Check Pods Manifest.lock」と「Compile Sources」の間

3、シュミレーターを起動させる

4、AddFileからR.generated.swiftを選択、生成されていることを確認

コピペ用

//スクリプト

"$PODS_ROOT/R.swift/rswift" generate "$SRCROOT/$PROJECT_NAME/R.generated.swift"

//InputFiles

$TEMP_DIR/rswift-lastrun

//OutputFiles

$SRCROOT/$PROJECT_NAME/R.generated.swift

スクリーンショット 2020-12-10 10.32.43.png

スクリーンショット 2020-12-10 10.47.50.png
スクリーンショット 2020-12-10 10.48.10.png

注意

import R.Swift //は必要ない

3、遷移したい所にコードを記入

//aaaはMain.storyboard のMainの部分(全て小文字になる)
//bbbはViewControllerのstoryboardID(大文字も含む)
let vc = R.storyboard.aaa.bbb()!
self.present(vc, animated: true, completion: nil)
1
1
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
1
1