Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 6, 2018
1 parent 25f4d02 commit 7c925b8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
8 changes: 6 additions & 2 deletions .swiftlint.yml
Expand Up @@ -7,6 +7,7 @@ disabled_rules:
- force_try
- large_tuple
- function_body_length
- nesting # Disabled because of https://github.com/realm/SwiftLint/issues/1151
opt_in_rules:
- empty_count
- prohibited_super_call
Expand Down Expand Up @@ -44,9 +45,12 @@ opt_in_rules:
- empty_string
- untyped_error_in_catch
- discouraged_optional_collection
- modifier_order
- unavailable_function
- multiline_function_chains
- redundant_set_access_control
- empty_xctest_method
force_cast: warning
force_unwrapping: warning
number_separator:
minimum_length: 5
excluded:
- Carthage
2 changes: 1 addition & 1 deletion Gifski.xcodeproj/project.pbxproj
Expand Up @@ -131,10 +131,10 @@
E3AE627A1E5CD2F300035A2F = {
isa = PBXGroup;
children = (
5A7524AD20D085FB00F12C99 /* gifski.xcodeproj */,
E3AE62851E5CD2F300035A2F /* Gifski */,
E3AE62841E5CD2F300035A2F /* Products */,
E317EE121F88305800359C57 /* Frameworks */,
5A7524AD20D085FB00F12C99 /* gifski.xcodeproj */,
);
sourceTree = "<group>";
usesTabs = 1;
Expand Down
1 change: 0 additions & 1 deletion Gifski/MainWindowController.swift
Expand Up @@ -11,7 +11,6 @@ final class MainWindowController: NSWindowController {
}

private lazy var videoDropView = with(VideoDropView()) {
$0.frame = window!.contentView!.frame
$0.dropText = "Drop a Video to Convert to GIF"
$0.onComplete = { url in
self.convert(url.first!)
Expand Down
2 changes: 1 addition & 1 deletion Gifski/Vendor/CircularProgress.swift
Expand Up @@ -65,7 +65,7 @@ public final class CircularProgress: NSView {
commonInit()
}

required public init?(coder: NSCoder) {
public required init?(coder: NSCoder) {
super.init(coder: coder)
commonInit()
}
Expand Down
21 changes: 15 additions & 6 deletions Gifski/VideoDropView.swift
Expand Up @@ -9,7 +9,7 @@ class DropView: SSView {
}
}

lazy private var dropLabel = with(Label()) {
private let dropLabel = with(Label()) {
$0.textColor = .controlAccent
}

Expand All @@ -27,21 +27,30 @@ class DropView: SSView {
}
}

override func didAppear() {
addSubviewToCenter(dropLabel)
dropLabel.pulsateScale(duration: 1.3)
}

override init(frame: NSRect) {
super.init(frame: frame)
autoresizingMask = [.width, .height]
registerForDraggedTypes(acceptedTypes)
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func didAppear() {
addSubviewToCenter(dropLabel)
dropLabel.pulsateScale(duration: 1.3)
}

override func layout() {
super.layout()

if let bounds = superview?.bounds {
frame = bounds
}
}

override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)

Expand Down
7 changes: 4 additions & 3 deletions Gifski/util.swift
Expand Up @@ -140,7 +140,7 @@ extension NSWindow {
}

@nonobjc
convenience override init() {
override convenience init() {
self.init(contentRect: NSWindow.defaultContentRect)
}

Expand Down Expand Up @@ -288,10 +288,10 @@ extension CMTime {
extension CMTimeScale {
/**
```
CMTime(seconds: (1 / fps) * Double(i), preferredTimescale: .video)
CMTime(seconds: 1 / fps, preferredTimescale: .video)
```
*/
static var video: Int32 = 600 // This is what Apple recommends
static var video: CMTimeScale = 600 // This is what Apple recommends
}


Expand Down Expand Up @@ -544,6 +544,7 @@ foo()
//=> "foo() in main.swift:1 has not been implemented"
```
*/
// swiftlint:disable:next unavailable_function
func unimplemented(function: StaticString = #function, file: String = #file, line: UInt = #line) -> Never {
fatalError("\(function) in \(file.nsString.lastPathComponent):\(line) has not been implemented")
}
Expand Down

0 comments on commit 7c925b8

Please sign in to comment.