gitリポジトリのurlを貼り付けるだけでアプリケーションのビルドを実行するアプリ。 macOS用
Révision | 17ab088f6cc9e89ee435ad1bd91680b34c325d57 (tree) |
---|---|
l'heure | 2018-04-08 00:46:50 |
Auteur | masakih <masakih@user...> |
Commiter | masakih |
GUI関連を関数の外に出した
@@ -55,7 +55,12 @@ class ViewController: NSViewController { | ||
55 | 55 | |
56 | 56 | @IBAction func doIt(_ sender: Any?) { |
57 | 57 | |
58 | - clone() | |
58 | + cloneButton.isEnabled = false | |
59 | + clone { | |
60 | + DispatchQueue.main.async { | |
61 | + self.cloneButton.isEnabled = true | |
62 | + } | |
63 | + } | |
59 | 64 | } |
60 | 65 | |
61 | 66 | } |
@@ -83,21 +88,17 @@ extension ViewController { | ||
83 | 88 | |
84 | 89 | extension ViewController { |
85 | 90 | |
86 | - fileprivate func clone() { | |
91 | + fileprivate func clone(completionHandler: @escaping () -> Void) { | |
87 | 92 | |
88 | 93 | guard let url = URL(string: urlField.stringValue) |
89 | 94 | else { return } |
90 | 95 | |
91 | - cloneButton.isEnabled = false | |
92 | - | |
93 | 96 | DispatchQueue(label: "MMMMM", attributes: .concurrent).async { |
94 | 97 | |
95 | 98 | self.progress = true |
96 | 99 | defer { |
97 | 100 | self.progress = false |
98 | - DispatchQueue.main.async { | |
99 | - self.cloneButton.isEnabled = true | |
100 | - } | |
101 | + completionHandler() | |
101 | 102 | } |
102 | 103 | |
103 | 104 | let gitCloner = Git(url) |