Create a MacOS app without Xcode
Create a MacOS app without Xcode
https://stackoverflow.com/a/53641189/29245654
mkdir MyApp
cd MyApp
swift package init --type executable
# swift build -c release
swift build
mkdir MyApp.app
cd MyApp.app
# cp ../.build/release/MyApp main
cp ../.build/debug/MyApp main
# cp /System/Applications/FindMy.app/Contents/Resources/AppIcon.icns AppIcon.icns # you can change it later
touch AppIcon.icns
touch Info.plist
Copy following content to your Info.plist, change your strings when neccessary
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>MyApp</string>
<key>CFBundleExecutable</key>
<string>main</string>
<key>CFBundleIdentifier</key>
<string>hangj.cnblogs.com.MyApp</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>MyApp</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundleIconName</key>
<string>AppIcon</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
+V why_null 请备注:from博客园
浙公网安备 33010602011771号