Help us understand the problem. What is going on with this article?

プロジェクト内で利用しているuserDefinedRuntimeAttributeの一覧を出力するコマンド

More than 1 year has passed since last update.

概要

Xcodeプロジェクト内で利用しているuserDefinedRuntimeAttributeの一覧を取得する方法です。

スクリーンショット 2017-05-11 23.04.31.png

コマンド

以下のコマンドをコピペしてターミナルで実行することで取得できます。

プロジェクトのディレクトリで実行
$ find . -name "*.xib" -o -name "*.storyboard" \
| xargs grep "<userDefinedRuntimeAttribute type" \
| grep "keyPath"  \
| sed -e "s/.*keyPath=\"//g" \
| sed -e "s/\".*>//g" \
| sort \
| uniq

実行結果(例)

userDefinedRuntimeAttributeの一覧がソートされ、出力されます。

borderColor
borderWidth
bottomBorderWidth
clipsToBounds
cornerRadius
〜略〜

コマンド解説

実行フォルダ配下の拡張子がxibもしくはstoryboardのファイルを検索
$ find . -name "*.xib" -o -name "*.storyboard" \
userDefinedRuntimeAttributeタグを含む行を抽出
| xargs grep "<userDefinedRuntimeAttribute type" \
keyPath属性を含む行を抽出
| grep "keyPath"  \
keyPath属性の値のみを置換で抽出
| sed -e "s/.*keyPath=\"//g" \
| sed -e "s/\".*>//g" \
属性値をソート
| sort \
重複した行を削除
| uniq
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away