Skip to content

Instantly share code, notes, and snippets.

@unixb0y
Last active June 19, 2020 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unixb0y/da453402c206cf55fc184ba1170c082e to your computer and use it in GitHub Desktop.
Save unixb0y/da453402c206cf55fc184ba1170c082e to your computer and use it in GitHub Desktop.
Easily remove storyboard of a fresh Xcode 11.3.1+ project and do all your layout in code.
if [ $# -eq 0 ]
then echo 'No project name supplied'; exit 0
fi
# 1) Add necessary Code to SceneDelegate
a='guard let _ = (scene as? UIWindowScene) else { return }'
b='guard let windowScene = (scene as? UIWindowScene) else { return }\
window = UIWindow()\
window?.windowScene = windowScene\
window?.rootViewController = ViewController()\
window?.makeKeyAndVisible()'
sed -i '' "s/$a/$b/" $1/$1/SceneDelegate.swift
# 2) Delete Information from Info.plist
sed -i '' -e '/UIMainStoryboardFile/ {
$!N
d
}' -e '/UISceneStoryboardFile/ {
$!N
d
}' $1/$1/Info.plist
# 3) Delete Storyboard
rm $1/$1/Base.lproj/Main.storyboard
# 4) Delete references to Main.storyboard
sed -i '' -e '/Main.storyboard in Resources/d' -e '/Main.storyboard \*\/,/d' -e '/Base.lproj\/Main.storyboard/d' -e '/Main.storyboard \*\/ =/ {
$!N
$!N
$!N
$!N
$!N
$!N
$!N
d
}' $1/$1.xcodeproj/project.pbxproj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment