defaults
命令更新Xcode的NSUserDefaults
来完成。
https://gist.github.com/brennanMKE/7d9f190859a0f15fdc32c0811bf24386
# Note: Xcode shows these values in Settings -> Locations -> Custom Paths
# Xcode does not hot reload these values so you must restart Xcode to get the changes.
# Define a dictionary entry for LUMBERJACK_DIR with a display name
defaults write com.apple.dt.Xcode IDEApplicationwideBuildSettings -dict-add LUMBERJACK_DIR "\$LUMBERJACK_DIR"
defaults write com.apple.dt.Xcode IDESourceTreeDisplayNames -dict-add LUMBERJACK_DIR "Lumberjack 1.0"
# Change the display name
defaults write com.apple.dt.Xcode IDESourceTreeDisplayNames -dict-add LUMBERJACK_DIR "Lumberjack 2.0"
# View the values which match this key
defaults read com.apple.dt.Xcode IDEApplicationwideBuildSettings | grep LUMBERJACK_DIR
defaults read com.apple.dt.Xcode IDESourceTreeDisplayNames | grep LUMBERJACK_DIR
# Your Xcode project can define the $LUMBERJACK_DIR value in an .xcconfig variable.
# Be sure to add your .xcconfig to your project configuration for your current build configuration.