LoginSignup
6
6

More than 5 years have passed since last update.

ibtoolを使ってXibファイル内のクラス名を一括変更する

Posted at

ibtoolはローカライズで使用するシーンを良く見かけますが、Xibファイル内のクラス名を一括変更したいという話を聞きまして、どうも手作業でやろうとしていたのでそんなことしなくてももっと良い方法あるんじゃないの?と思い、ちょっと調べてみました。

で、ibtoolのconvertオプションです。

引用元:ibtool(1) Mac OS X Developer Tools Manual Page

--convert old-new
Rename the class named 'old' to 'new'. If 'old' ends with an '*', then rename all classes
beginning with 'old' to instead begin with 'new'. This Updates all outlet types, class names,
custom classes, as well as actual instances.

convertオプションを指定してその後に置換対象の文字列と置換する文字列をハイフン(-)でつないで置換ルールを指定します。
ちなみにXibファイルですとワイルドカードが使えるようです。

ibtool --convert Old*-New file

例では指定していませんが、実際に使用するときは--writeオプションで出力先ファイルを指定しないと変換後のファイルが出力されないようなので注意しましょう。

6
6
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
6
6