17
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【SwiftUI】PreviewでRunScriptが走らないようにする

Posted at

はじめに

Preview時にRunScriptが走ってPreviewが長くなるという問題に直面したので、Previewの時はRunScriptを実行しないようにします。

現在のスクリプト

こちらのスクリプトをサンプルとして使います

export PATH=/opt/homebrew/bin:$PATH

if which mint >/dev/null; then
    # SwiftFormat
    xcrun --sdk macosx mint run swiftformat .
else 
    echo 'warning: mint not installed.'
fi

修正後のスクリプト

export PATH=/opt/homebrew/bin:$PATH

if which mint >/dev/null && [ \"$ENABLE_PREVIEWS\" == \"NO\" ]; then
    # SwiftFormat
    xcrun --sdk macosx mint run swiftformat .
else 
    echo 'warning: skip run script'
fi

ポイント
[ \"$ENABLE_PREVIEWS\" == \"NO\" ]
ここでPreviewか判定しています

参考記事

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?