LoginSignup
1
2

More than 3 years have passed since last update.

Xcode+Swiftでの、macOSのapp作成時のメモ

Last updated at Posted at 2020-02-02

Xcode+Swiftでの、macOSのapp作成時のメモ

macOS Catalina 10.15.2
Xcode 10.2.1 10E1001
Swift 5.0.1

1)どこでもフォルダやファイルをほいほい作れないのはSandbox機能がオフでないから
スクリーンショット 2020-02-02 15.38.32.png

2)書き出したアプリのOSのバージョンを指定
スクリーンショット 2020-02-02 15.39.22.png

3)フォームのタイトルはここ
スクリーンショット 2020-02-08 9.28.39.png

4)バツボタンで、アプリをクローズする

AppDelegate.swift

func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
    return true
}

スクリーンショット 2020-02-08 15.26.02.png

5)ウィンドウの初期表示位置を決める
スクリーンショット 2020-02-15 13.56.07.png

6)アプリ自体の、アイコンを設定する
スクリーンショット 2020-02-15 13.53.27.png

7)ファインダー/Finder で、指定フォルダを開く

let theWorkspace : NSWorkspace = NSWorkspace.shared
theWorkspace.openFile(folderPATH)

8)メッセージボックスを出す

  let alert = NSAlert()
  alert.messageText = "メッセージはここ"
  alert.runModal()
1
2
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
1
2