From: masakih Date: Sun, 12 Mar 2017 13:03:15 +0000 (+0900) Subject: swiftlint 'legacy_constructor' の警告を修正 X-Git-Tag: 1.9b3~30 X-Git-Url: http://git.osdn.net/view?p=kcd%2FKCD.git;a=commitdiff_plain;h=377bbf72d0f99929651846b7745d7e5f6e4bd8c1 swiftlint 'legacy_constructor' の警告を修正 --- diff --git a/.swiftlint.yml b/.swiftlint.yml index 473a7e68..1ecefc63 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -6,7 +6,6 @@ disabled_rules: - force_try - leading_whitespace - vertical_whitespace - - legacy_constructor - cyclomatic_complexity - legacy_nsgeometry_functions - redundant_optional_initialization diff --git a/KCD/GameViewController.swift b/KCD/GameViewController.swift index 0bad2c39..97bc53e4 100644 --- a/KCD/GameViewController.swift +++ b/KCD/GameViewController.swift @@ -163,7 +163,7 @@ extension GameViewController: WebFrameLoadDelegate, WebUIDelegate { ) let top = context.objectForKeyedSubscript("atop").toDouble() let left = context.objectForKeyedSubscript("aleft").toDouble() - flashTopLeft = NSMakePoint(CGFloat(left), webView.frame.size.height - CGFloat(top) - 480) + flashTopLeft = NSPoint(x: CGFloat(left), y: webView.frame.size.height - CGFloat(top) - 480) } if path.hasSuffix("app_id=854854") { guard let context = frame.javaScriptContext else { return } @@ -183,7 +183,7 @@ extension GameViewController: WebFrameLoadDelegate, WebUIDelegate { guard validIframe != 0 else { return } let top = context.objectForKeyedSubscript("atop").toDouble() let left = context.objectForKeyedSubscript("aleft").toDouble() - flashTopLeft = NSMakePoint(flashTopLeft.x + CGFloat(left), flashTopLeft.y - CGFloat(top)) + flashTopLeft = NSPoint(x: flashTopLeft.x + CGFloat(left), y: flashTopLeft.y - CGFloat(top)) adjustFlash() } } diff --git a/KCD/HistoryMarkTransformer.swift b/KCD/HistoryMarkTransformer.swift index a55431d1..3e633d07 100644 --- a/KCD/HistoryMarkTransformer.swift +++ b/KCD/HistoryMarkTransformer.swift @@ -19,10 +19,10 @@ class HistoryMarkTransformer: ValueTransformer { static var markImage: NSImage = { let radius: CGFloat = 10.0 - let image = NSImage(size: NSMakeSize(radius, radius)) + let image = NSImage(size: NSSize(width: radius, height: radius)) image.lockFocus() NSColor.red.highlight(withLevel: 0.6)?.set() - NSBezierPath(roundedRect: NSMakeRect(0, 0, radius, radius), + NSBezierPath(roundedRect: NSRect(x: 0, y: 0, width: radius, height: radius), xRadius: radius / 2, yRadius: radius / 2) .fill() diff --git a/KCD/ImageView.swift b/KCD/ImageView.swift index 1f242932..83267ded 100644 --- a/KCD/ImageView.swift +++ b/KCD/ImageView.swift @@ -33,7 +33,7 @@ class ImageView: NSView { private var imageShadow: NSShadow { if let s = internalImageShadow { return s } let s = NSShadow() - s.shadowOffset = NSMakeSize(2, -2) + s.shadowOffset = NSSize(width: 2, height: -2) s.shadowBlurRadius = 4 s.shadowColor = NSColor.darkGray internalImageShadow = s diff --git a/KCD/ScreenshotCollectionViewItem.swift b/KCD/ScreenshotCollectionViewItem.swift index 55d315c3..65ad979c 100644 --- a/KCD/ScreenshotCollectionViewItem.swift +++ b/KCD/ScreenshotCollectionViewItem.swift @@ -48,10 +48,10 @@ class ScreenshotCollectionViewItem: NSCollectionViewItem { } else { ratio = ratioX } - let fitSize = NSMakeSize(imageSize.width * ratio, imageSize.height * ratio) + let fitSize = NSSize(width: imageSize.width * ratio, height: imageSize.height * ratio) let left = (target.size.width - fitSize.width) * 0.5 let bottom = (target.size.height - fitSize.height) * 0.5 - return NSMakeRect(left, bottom, fitSize.width, fitSize.height) + return NSRect(x: left, y: bottom, width: fitSize.width, height: fitSize.height) } } diff --git a/KCD/ScreenshotEditorViewController.swift b/KCD/ScreenshotEditorViewController.swift index dc3f3568..b1ccded0 100644 --- a/KCD/ScreenshotEditorViewController.swift +++ b/KCD/ScreenshotEditorViewController.swift @@ -39,9 +39,9 @@ class ScreenshotEditorViewController: BridgeViewController { override init?(nibName: String?, bundle: Bundle?) { trimInfo = [ - TrimRectInformation(name: "Status", rect: NSMakeRect(328, 13, 470, 365)), - TrimRectInformation(name: "List", rect: NSMakeRect(362, 15, 438, 368)), - TrimRectInformation(name: "AirplaneBase", rect: NSMakeRect(575, 13, 225, 358)) + TrimRectInformation(name: "Status", rect: NSRect(x: 328, y: 13, width: 470, height: 365)), + TrimRectInformation(name: "List", rect: NSRect(x: 362, y: 15, width: 438, height: 368)), + TrimRectInformation(name: "AirplaneBase", rect: NSRect(x: 575, y: 13, width: 225, height: 358)) ] currentTrimInfo = trimInfo[0] super.init(nibName: "ScreenshotEditorViewController", bundle: nil) diff --git a/KCD/ScreenshotListViewController.swift b/KCD/ScreenshotListViewController.swift index e024c8c9..10ce9031 100644 --- a/KCD/ScreenshotListViewController.swift +++ b/KCD/ScreenshotListViewController.swift @@ -307,7 +307,7 @@ class ScreenshotListViewController: NSViewController { extension ScreenshotListViewController: NSCollectionViewDelegateFlowLayout { func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize { let f = realFromZoom(zoom: zoom) - return NSMakeSize(f, f) + return NSSize(width: f, height: f) } } diff --git a/KCD/StrokeTextFieldCell.swift b/KCD/StrokeTextFieldCell.swift index 4064759c..3b2568f6 100644 --- a/KCD/StrokeTextFieldCell.swift +++ b/KCD/StrokeTextFieldCell.swift @@ -40,7 +40,7 @@ class StrokeTextFieldCell: NSTextFieldCell { let range = layoutManager.glyphRange(for: textContainer) let glyph = UnsafeMutablePointer.allocate(capacity: range.length) let glyphLength = layoutManager.getGlyphs(in: range, glyphs: glyph, properties: nil, characterIndexes: nil, bidiLevels: nil) - var point = NSMakePoint(StrokeTextFieldCell.boarderWidth, 0) + var point = NSPoint(x: StrokeTextFieldCell.boarderWidth, y: 0) point.y -= font.descender if controlView.isFlipped { point.y -= NSHeight(controlView.frame) diff --git a/KCD/SuppliesCell.swift b/KCD/SuppliesCell.swift index fac67671..7f7557ac 100644 --- a/KCD/SuppliesCell.swift +++ b/KCD/SuppliesCell.swift @@ -61,7 +61,7 @@ class SuppliesCell: NSCell { let y: CGFloat = type == .fuel ? height + 2.0 : 1.0 for i in 0...10 { let x: CGFloat = CGFloat(1 + i) + width * CGFloat(i) - let cellRect = NSMakeRect(x, y, width, height) + let cellRect = NSRect(x: x, y: y, width: width, height: height) color(of: type, position: i, border: border).set() NSBezierPath(rect: cellRect).fill() }