main code repository.
Revision | d308b72f9032f10ba439e728c81d4e30db035f33 (tree) |
---|---|
Time | 2017-10-14 21:54:45 |
Author | masakih <masakih@user...> |
Commiter | masakih |
verをletに変更
@@ -189,7 +189,7 @@ extension DefaultKeys { | ||
189 | 189 | static let defaults: [String: Any] = settings |
190 | 190 | .flatMap { (k: DefaultKeys, v: Any?) -> (key: String, value: Any)? in |
191 | 191 | |
192 | - guard var value = v else { return nil } | |
192 | + guard let value = v else { return nil } | |
193 | 193 | |
194 | 194 | if isDefaultValuePrimitive(value) { |
195 | 195 |
@@ -248,7 +248,7 @@ final class ScreenshotListViewController: NSViewController { | ||
248 | 248 | |
249 | 249 | let imageTypes = NSImage.imageTypes |
250 | 250 | let ws = NSWorkspace.shared |
251 | - var current = screenshots.screenshots | |
251 | + let current = screenshots.screenshots | |
252 | 252 | let newFiles: [URL] = f.flatMap { |
253 | 253 | |
254 | 254 | guard let type = try? ws.type(ofFile: $0.path) else { return nil } |
@@ -257,16 +257,16 @@ final class ScreenshotListViewController: NSViewController { | ||
257 | 257 | } |
258 | 258 | |
259 | 259 | // なくなっているものを削除 |
260 | - current = current.filter { newFiles.contains($0.url) } | |
260 | + let itemWithoutDeleting = current.filter { newFiles.contains($0.url) } | |
261 | 261 | |
262 | 262 | // 新しいものを追加 |
263 | 263 | let new: [ScreenshotInformation] = newFiles.flatMap { url in |
264 | 264 | |
265 | - if current.contains(where: { url == $0.url }) { return nil } | |
265 | + if itemWithoutDeleting.contains(where: { url == $0.url }) { return nil } | |
266 | 266 | return ScreenshotInformation(url: url) |
267 | 267 | } |
268 | 268 | |
269 | - screenshots.screenshots = current + new | |
269 | + screenshots.screenshots = itemWithoutDeleting + new | |
270 | 270 | |
271 | 271 | collectionView.selectionIndexPaths = [NSIndexPath(forItem: 0, inSection: 0) as IndexPath] |
272 | 272 |