gitリポジトリのurlを貼り付けるだけでアプリケーションのビルドを実行するアプリ。 macOS用
Revision | a3d98f58812d5e40a807a0acd0a399c485014bce (tree) |
---|---|
Zeit | 2017-08-12 23:59:18 |
Autor | masakih <masakih@user...> |
Commiter | masakih |
ソースコードを整理
@@ -57,7 +57,32 @@ class ViewController: NSViewController { | ||
57 | 57 | clone() |
58 | 58 | } |
59 | 59 | |
60 | - private func clone() { | |
60 | +} | |
61 | + | |
62 | +extension ViewController { | |
63 | + | |
64 | + override func controlTextDidChange(_ obj: Notification) { | |
65 | + | |
66 | + guard let tx = obj.object as? NSTextField else { return } | |
67 | + | |
68 | + if let url = URL(string: tx.stringValue), | |
69 | + let scheme = url.scheme, | |
70 | + (scheme == "git") || (scheme == "http") || (scheme == "https"), | |
71 | + let host = url.host, host != "", | |
72 | + url.path != "/", url.path != "" { | |
73 | + | |
74 | + cloneButton.isEnabled = true | |
75 | + | |
76 | + } else { | |
77 | + | |
78 | + cloneButton.isEnabled = false | |
79 | + } | |
80 | + } | |
81 | +} | |
82 | + | |
83 | +extension ViewController { | |
84 | + | |
85 | + fileprivate func clone() { | |
61 | 86 | |
62 | 87 | guard let url = URL(string: urlField.stringValue) |
63 | 88 | else { return } |
@@ -124,24 +149,3 @@ class ViewController: NSViewController { | ||
124 | 149 | |
125 | 150 | } |
126 | 151 | |
127 | - | |
128 | -extension ViewController { | |
129 | - | |
130 | - override func controlTextDidChange(_ obj: Notification) { | |
131 | - | |
132 | - guard let tx = obj.object as? NSTextField else { return } | |
133 | - | |
134 | - if let url = URL(string: tx.stringValue), | |
135 | - let scheme = url.scheme, | |
136 | - (scheme == "git") || (scheme == "http") || (scheme == "https"), | |
137 | - let host = url.host, host != "", | |
138 | - url.path != "/", url.path != "" { | |
139 | - | |
140 | - cloneButton.isEnabled = true | |
141 | - | |
142 | - } else { | |
143 | - | |
144 | - cloneButton.isEnabled = false | |
145 | - } | |
146 | - } | |
147 | -} |