summaryrefslogtreecommitdiffstats
path: root/video/out/mac/view.swift
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/mac/view.swift')
-rw-r--r--video/out/mac/view.swift11
1 files changed, 6 insertions, 5 deletions
diff --git a/video/out/mac/view.swift b/video/out/mac/view.swift
index 047a5238e4..b82151ba96 100644
--- a/video/out/mac/view.swift
+++ b/video/out/mac/view.swift
@@ -19,7 +19,7 @@ import Cocoa
class View: NSView, CALayerDelegate {
unowned var common: Common
- var input: InputHelper? { get { return common.input } }
+ var input: InputHelper? { return common.input }
var tracker: NSTrackingArea?
var hasMouseDown: Bool = false
@@ -27,12 +27,12 @@ class View: NSView, CALayerDelegate {
override var isFlipped: Bool { return true }
override var acceptsFirstResponder: Bool { return true }
-
init(frame: NSRect, common com: Common) {
common = com
super.init(frame: frame)
autoresizingMask = [.width, .height]
wantsBestResolutionOpenGLSurface = true
+ wantsExtendedDynamicRangeOpenGLSurface = true
registerForDraggedTypes([ .fileURL, .URL, .string ])
}
@@ -65,9 +65,10 @@ class View: NSView, CALayerDelegate {
}
func isURL(_ str: String) -> Bool {
- // force unwrapping is fine here, regex is guaranteed to be valid
- let regex = try! NSRegularExpression(pattern: "^(https?|ftp)://[^\\s/$.?#].[^\\s]*$",
- options: .caseInsensitive)
+ guard let regex = try? NSRegularExpression(pattern: "^(https?|ftp)://[^\\s/$.?#].[^\\s]*$",
+ options: .caseInsensitive) else {
+ return false
+ }
let isURL = regex.numberOfMatches(in: str,
options: [],
range: NSRange(location: 0, length: str.count))