Last active
June 19, 2020 23:40
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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