Initial commit: SimVision tvOS streaming app

Features:
- VOD library with movie grouping and version detection
- TV show library with season/episode organization
- TMDB integration for trending shows and recently aired episodes
- Recent releases section with TMDB release date sorting
- Watch history tracking with continue watching
- Playlist caching (12-hour TTL) for offline support
- M3U playlist parsing with XStream API support
- Authentication with credential storage

Technical:
- SwiftUI for tvOS
- Actor-based services for thread safety
- Persistent caching for playlists, TMDB data, and watch history
- KSPlayer integration for video playback

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-21 22:12:08 -06:00
commit 872354b834
283 changed files with 338296 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import QuartzCore
var _buffer = ContiguousArray<Int?>(repeating: 1, count: 102_400)
var startTime = CACurrentMediaTime()
_buffer.removeAll(keepingCapacity: true)
_buffer.append(contentsOf: ContiguousArray<Int?>(repeating: nil, count: 102_400))
var diff = CACurrentMediaTime() - startTime
print(diff)
_buffer = ContiguousArray<Int?>(repeating: 1, count: 102_400)
startTime = CACurrentMediaTime()
(0 ..< _buffer.count).forEach { _buffer[$0] = nil }
diff = CACurrentMediaTime() - startTime
print(diff)
let ass = #"{\alpha&H00&\t(1700,2000,\alpha&HFF&)\blur1\fsp1\fn方正兰亭特黑长_GBK\fs13\frz1.33\c&H312A17&\b1\t(65,1982,\blur4.5)\pos(142.51,66.32)}拉斯维加斯 城{\fsp0}界"#
let styleArr = ass.components(separatedBy: CharacterSet(charactersIn: "{}"))
print(styleArr)

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='macos'>
<timeline fileName='timeline.xctimeline'/>
</playground>

View File

@@ -0,0 +1,429 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
AC0860E020B699E100D801FC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC0860DF20B699E100D801FC /* AppDelegate.swift */; };
AC0860E420B699E100D801FC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AC0860E320B699E100D801FC /* Assets.xcassets */; };
AC3B64632187411000570305 /* MainWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC3B64622187411000570305 /* MainWindow.swift */; };
AC62AEF020C9812F00A75F85 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = AC62AEEE20C9812F00A75F85 /* MainMenu.xib */; };
AC62AEF320C9830300A75F85 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC62AEF120C9830300A75F85 /* ViewController.swift */; };
AC62AEF420C9830300A75F85 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = AC62AEF220C9830300A75F85 /* ViewController.xib */; };
ACB5A251226579E1004C4EEF /* OpenURLWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACB5A24F226579E0004C4EEF /* OpenURLWindowController.swift */; };
ACB5A252226579E1004C4EEF /* OpenURLWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = ACB5A250226579E1004C4EEF /* OpenURLWindowController.xib */; };
FCE576E4DF033905B99A93E6 /* Pods_demo_macOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90F4636D697BEE812114E1B4 /* Pods_demo_macOS.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
3D5C3988D63E62A43D829A21 /* Pods-demo-macOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo-macOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-demo-macOS/Pods-demo-macOS.release.xcconfig"; sourceTree = "<group>"; };
90F4636D697BEE812114E1B4 /* Pods_demo_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_demo_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A594382B6971720DF80046C9 /* Pods-demo-macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo-macOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-demo-macOS/Pods-demo-macOS.debug.xcconfig"; sourceTree = "<group>"; };
AC0860DC20B699E100D801FC /* demo-macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "demo-macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
AC0860DF20B699E100D801FC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
AC0860E320B699E100D801FC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
AC0860E820B699E100D801FC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AC0860E920B699E100D801FC /* demo_macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = demo_macOS.entitlements; sourceTree = "<group>"; };
AC3B64622187411000570305 /* MainWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainWindow.swift; sourceTree = "<group>"; };
AC62AEEF20C9812F00A75F85 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
AC62AEF120C9830300A75F85 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
AC62AEF220C9830300A75F85 /* ViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ViewController.xib; sourceTree = "<group>"; };
ACB5A24F226579E0004C4EEF /* OpenURLWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenURLWindowController.swift; sourceTree = "<group>"; };
ACB5A250226579E1004C4EEF /* OpenURLWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OpenURLWindowController.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
AC0860D920B699E100D801FC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
FCE576E4DF033905B99A93E6 /* Pods_demo_macOS.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
26AF62C6941FD183334EE2EE /* Frameworks */ = {
isa = PBXGroup;
children = (
90F4636D697BEE812114E1B4 /* Pods_demo_macOS.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
8F070A54FB2B18199117B575 /* Pods */ = {
isa = PBXGroup;
children = (
A594382B6971720DF80046C9 /* Pods-demo-macOS.debug.xcconfig */,
3D5C3988D63E62A43D829A21 /* Pods-demo-macOS.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
AC0860D320B699E100D801FC = {
isa = PBXGroup;
children = (
AC0860DE20B699E100D801FC /* demo-macOS */,
AC0860DD20B699E100D801FC /* Products */,
8F070A54FB2B18199117B575 /* Pods */,
26AF62C6941FD183334EE2EE /* Frameworks */,
);
sourceTree = "<group>";
};
AC0860DD20B699E100D801FC /* Products */ = {
isa = PBXGroup;
children = (
AC0860DC20B699E100D801FC /* demo-macOS.app */,
);
name = Products;
sourceTree = "<group>";
};
AC0860DE20B699E100D801FC /* demo-macOS */ = {
isa = PBXGroup;
children = (
AC0860DF20B699E100D801FC /* AppDelegate.swift */,
AC3B64622187411000570305 /* MainWindow.swift */,
AC62AEF120C9830300A75F85 /* ViewController.swift */,
AC62AEF220C9830300A75F85 /* ViewController.xib */,
ACB5A24F226579E0004C4EEF /* OpenURLWindowController.swift */,
ACB5A250226579E1004C4EEF /* OpenURLWindowController.xib */,
AC0860E320B699E100D801FC /* Assets.xcassets */,
AC62AEEE20C9812F00A75F85 /* MainMenu.xib */,
AC0860E820B699E100D801FC /* Info.plist */,
AC0860E920B699E100D801FC /* demo_macOS.entitlements */,
);
path = "demo-macOS";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
AC0860DB20B699E100D801FC /* demo-macOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = AC08610220B699E200D801FC /* Build configuration list for PBXNativeTarget "demo-macOS" */;
buildPhases = (
66D566658ED1703BA9764C71 /* [CP] Check Pods Manifest.lock */,
AC0860D820B699E100D801FC /* Sources */,
AC0860D920B699E100D801FC /* Frameworks */,
AC0860DA20B699E100D801FC /* Resources */,
133E8CF4B3B00793938F3D16 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
name = "demo-macOS";
productName = "demo-macOS";
productReference = AC0860DC20B699E100D801FC /* demo-macOS.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
AC0860D420B699E100D801FC /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 0930;
LastUpgradeCheck = 1500;
ORGANIZATIONNAME = kintan;
TargetAttributes = {
AC0860DB20B699E100D801FC = {
CreatedOnToolsVersion = 9.3.1;
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = AC0860D720B699E100D801FC /* Build configuration list for PBXProject "demo-macOS" */;
compatibilityVersion = "Xcode 11.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = AC0860D320B699E100D801FC;
productRefGroup = AC0860DD20B699E100D801FC /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
AC0860DB20B699E100D801FC /* demo-macOS */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
AC0860DA20B699E100D801FC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AC0860E420B699E100D801FC /* Assets.xcassets in Resources */,
ACB5A252226579E1004C4EEF /* OpenURLWindowController.xib in Resources */,
AC62AEF420C9830300A75F85 /* ViewController.xib in Resources */,
AC62AEF020C9812F00A75F85 /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
133E8CF4B3B00793938F3D16 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-demo-macOS/Pods-demo-macOS-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-demo-macOS/Pods-demo-macOS-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-demo-macOS/Pods-demo-macOS-resources.sh\"\n";
showEnvVarsInLog = 0;
};
66D566658ED1703BA9764C71 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-demo-macOS-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
AC0860D820B699E100D801FC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AC3B64632187411000570305 /* MainWindow.swift in Sources */,
ACB5A251226579E1004C4EEF /* OpenURLWindowController.swift in Sources */,
AC62AEF320C9830300A75F85 /* ViewController.swift in Sources */,
AC0860E020B699E100D801FC /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
AC62AEEE20C9812F00A75F85 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
AC62AEEF20C9812F00A75F85 /* Base */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
AC08610020B699E200D801FC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
};
name = Debug;
};
AC08610120B699E200D801FC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 4.2;
};
name = Release;
};
AC08610320B699E200D801FC /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = A594382B6971720DF80046C9 /* Pods-demo-macOS.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "demo-macOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "kintan.demo-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
AC08610420B699E200D801FC /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3D5C3988D63E62A43D829A21 /* Pods-demo-macOS.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "demo-macOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "kintan.demo-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
AC0860D720B699E100D801FC /* Build configuration list for PBXProject "demo-macOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AC08610020B699E200D801FC /* Debug */,
AC08610120B699E200D801FC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
AC08610220B699E200D801FC /* Build configuration list for PBXNativeTarget "demo-macOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AC08610320B699E200D801FC /* Debug */,
AC08610420B699E200D801FC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = AC0860D420B699E100D801FC /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:demo-macOS.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,89 @@
//
// AppDelegate.swift
// demo-macOS
//
// Created by kintan on 2018/5/24.
// Copyright © 2018 kintan. All rights reserved.
//
import AppKit
@main
class AppDelegate: NSObject, NSApplicationDelegate {
private lazy var openURLWindow = OpenURLWindowController()
private var window = MainWindow()
func applicationWillFinishLaunching(_: Notification) {}
func applicationDidFinishLaunching(_: Notification) {
NSApplication.shared.servicesProvider = self
if window.vc.url == nil {
openDocument(self)
}
}
func applicationWillTerminate(_: Notification) {
// Insert code here to tear down your application
}
@IBAction func openDocument(_: AnyObject) {
let panel = NSOpenPanel()
panel.title = NSLocalizedString("alert.choose_media_file.title", comment: "Choose Media File")
panel.canCreateDirectories = false
panel.canChooseFiles = true
panel.canChooseDirectories = true
panel.allowsMultipleSelection = false
if panel.runModal() == .OK {
for url in panel.urls {
NSDocumentController.shared.noteNewRecentDocumentURL(url)
}
if let url = panel.urls.first {
open(url: url)
}
}
}
@IBAction func openURL(_: AnyObject) {
openURLWindow.showWindow(nil)
openURLWindow.resetFields()
}
func application(_: NSApplication, openFile _: String) -> Bool {
true
}
func application(_: NSApplication, openFiles filenames: [String]) {
if let first = filenames.first {
open(string: first)
}
}
// MARK: - URL Scheme
@objc func handleURLEvent(event: NSAppleEventDescriptor, withReplyEvent _: NSAppleEventDescriptor) {
guard let url = event.paramDescriptor(forKeyword: keyDirectObject)?.stringValue else { return }
open(string: url)
}
// MARK: - Accept dropped string and URL
// @objc func droppedText(_ pboard: NSPasteboard, userData _: String, error _: NSErrorPointer) {
// if let url = pboard.string(forType: .string) {
// open(string: url)
// }
// }
func open(string: String) {
if string.first == "/" {
open(url: URL(fileURLWithPath: string))
} else {
if let url = URL(string: string) {
open(url: url)
}
}
}
func open(url: URL) {
window.open(url: url)
}
}

View File

@@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,684 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="demo_macOS" customModuleProvider="target"/>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="demo-macOS" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="demo-macOS" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About demo-macOS" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
<menuItem title="Services" id="NMo-om-nkz">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide demo-macOS" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
</connections>
</menuItem>
<menuItem title="Show All" id="Kd2-mp-pUS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit demo-macOS" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="File" id="dMs-cI-mzQ">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="File" id="bib-Uj-vzu">
<items>
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
<connections>
<action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
</connections>
</menuItem>
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
<connections>
<action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
</connections>
</menuItem>
<menuItem title="Open URL" keyEquivalent="o" id="HWe-pN-Oil">
<connections>
<action selector="openURL:" target="Voe-Tx-rLC" id="9CD-uc-0Nk"/>
</connections>
</menuItem>
<menuItem title="Open Recent" id="tXI-mr-wws">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
<items>
<menuItem title="Clear Menu" id="vNY-rz-j42">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
<connections>
<action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
</connections>
</menuItem>
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
<connections>
<action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
</connections>
</menuItem>
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
<connections>
<action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
</connections>
</menuItem>
<menuItem title="Revert to Saved" keyEquivalent="r" id="KaW-ft-85H">
<connections>
<action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections>
<action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
</connections>
</menuItem>
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
<connections>
<action selector="print:" target="-1" id="qaZ-4w-aoO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
<items>
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
<connections>
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
<connections>
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
<connections>
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<connections>
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
<connections>
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
</connections>
</menuItem>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
</connections>
</menuItem>
<menuItem title="Delete" id="pa3-QI-u2k">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
<connections>
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
<menuItem title="Find" id="4EN-yA-p0u">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Find" id="1b7-l0-nxx">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
<connections>
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
</connections>
</menuItem>
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
</connections>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
<connections>
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
</connections>
</menuItem>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
<connections>
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
</connections>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
<connections>
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
<connections>
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
<items>
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
<connections>
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
</connections>
</menuItem>
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
<connections>
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
</connections>
</menuItem>
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
</connections>
</menuItem>
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Substitutions" id="9ic-FL-obx">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
<items>
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
</connections>
</menuItem>
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
</connections>
</menuItem>
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
</connections>
</menuItem>
<menuItem title="Smart Links" id="cwL-P1-jid">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
</connections>
</menuItem>
<menuItem title="Data Detectors" id="tRr-pd-1PS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
</connections>
</menuItem>
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Transformations" id="2oI-Rn-ZJC">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
<items>
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
</connections>
</menuItem>
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
</connections>
</menuItem>
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="xrE-MZ-jX0">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
<items>
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
</connections>
</menuItem>
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Format" id="jxT-CU-nIS">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
<items>
<menuItem title="Font" id="Gi5-1S-RQB">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
<items>
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
<connections>
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
</connections>
</menuItem>
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
</connections>
</menuItem>
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
</connections>
</menuItem>
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
<connections>
<action selector="underline:" target="-1" id="FYS-2b-JAY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
</connections>
</menuItem>
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
<menuItem title="Kern" id="jBQ-r6-VK2">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
<items>
<menuItem title="Use Default" id="GUa-eO-cwY">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
</connections>
</menuItem>
<menuItem title="Use None" id="cDB-IK-hbR">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
</connections>
</menuItem>
<menuItem title="Tighten" id="46P-cB-AYj">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
</connections>
</menuItem>
<menuItem title="Loosen" id="ogc-rX-tC1">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Ligatures" id="o6e-r0-MWq">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
<items>
<menuItem title="Use Default" id="agt-UL-0e3">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
</connections>
</menuItem>
<menuItem title="Use None" id="J7y-lM-qPV">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
</connections>
</menuItem>
<menuItem title="Use All" id="xQD-1f-W4t">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Baseline" id="OaQ-X3-Vso">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
<items>
<menuItem title="Use Default" id="3Om-Ey-2VK">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
</connections>
</menuItem>
<menuItem title="Superscript" id="Rqc-34-cIF">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
</connections>
</menuItem>
<menuItem title="Subscript" id="I0S-gh-46l">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
</connections>
</menuItem>
<menuItem title="Raise" id="2h7-ER-AoG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
</connections>
</menuItem>
<menuItem title="Lower" id="1tx-W0-xDw">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
<connections>
<action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
</connections>
</menuItem>
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Text" id="Fal-I4-PZk">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Text" id="d9c-me-L2H">
<items>
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
<connections>
<action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
</connections>
</menuItem>
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
<connections>
<action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
</connections>
</menuItem>
<menuItem title="Justify" id="J5U-5w-g23">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
</connections>
</menuItem>
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
<connections>
<action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
<menuItem title="Writing Direction" id="H1b-Si-o9J">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
<items>
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="YGs-j5-SAR">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
</connections>
</menuItem>
<menuItem id="Lbh-J2-qVU">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
</connections>
</menuItem>
<menuItem id="jFq-tB-4Kx">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="Nop-cj-93Q">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
</connections>
</menuItem>
<menuItem id="BgM-ve-c93">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
</connections>
</menuItem>
<menuItem id="RB4-Sm-HuC">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
<menuItem title="Show Ruler" id="vLm-3I-IUL">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
</connections>
</menuItem>
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
</connections>
</menuItem>
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="H8h-7b-M4v">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="View" id="HyV-fh-RgO">
<items>
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
</connections>
</menuItem>
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="hB3-LF-h0Y"/>
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleSidebar:" target="-1" id="iwa-gc-5KM"/>
</connections>
</menuItem>
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleFullScreen:" target="-1" id="dU3-MA-1Rq"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="aUF-d1-5bR">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
<connections>
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="R4o-n2-Eq4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="wpr-3q-Mcd">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
<items>
<menuItem title="demo-macOS Help" keyEquivalent="?" id="FKE-Sm-Kum">
<connections>
<action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</objects>
</document>

View File

@@ -0,0 +1,473 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.video</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018年 kintan. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mkv</string>
<string>mka</string>
<string>mk3d</string>
<string>mks</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_mkv.icns</string>
<key>CFBundleTypeName</key>
<string>Matroska video</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mka</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_mkv.icns</string>
<key>CFBundleTypeName</key>
<string>Matroska audio</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string></string>
</array>
<key>LSTypeIsPackage</key>
<false/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>rm</string>
<string>rmvb</string>
<string>ra</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_rm.icns</string>
<key>CFBundleTypeName</key>
<string>Real Media file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>asf</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_asf.icns</string>
<key>CFBundleTypeName</key>
<string>Advanced Systems Format (ASF) media</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aac</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_aac.icns</string>
<key>CFBundleTypeName</key>
<string>Advanced Audio Coding (AAC) media</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>flv</string>
<string>f4v</string>
<string>f4p</string>
<string>f4a</string>
<string>f4b</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_flv.icns</string>
<key>CFBundleTypeName</key>
<string>Flash Video file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>webm</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_webm.icns</string>
<key>CFBundleTypeName</key>
<string>WebM media</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>3gp</string>
<string>3g2</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_3gp.icns</string>
<key>CFBundleTypeName</key>
<string>3GPP media</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mp3</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_mp3.icns</string>
<key>CFBundleTypeName</key>
<string>MPEG Layer III (MP3) audio</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ogg</string>
<string>oga</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_ogg.icns</string>
<key>CFBundleTypeName</key>
<string>OGG audio</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ogm</string>
<string>ogv</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_ogg.icns</string>
<key>CFBundleTypeName</key>
<string>OGG video</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ts</string>
<string>mts</string>
<string>m2ts</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_ts.icns</string>
<key>CFBundleTypeName</key>
<string>MPEG transport stream (TS) media</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>avi</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_avi.icns</string>
<key>CFBundleTypeName</key>
<string>AVI media</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>wav</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_wav.icns</string>
<key>CFBundleTypeName</key>
<string>Waveform Audio File (WAV) audio</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>m4a</string>
<string>m4b</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_m4a.icns</string>
<key>CFBundleTypeName</key>
<string>MPEG-4 audio</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>wmv</string>
<string>wma</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_wmv.icns</string>
<key>CFBundleTypeName</key>
<string>Windows Media Video/Audio (WMV/WMA) media</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>qt</string>
<string>mov</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_qt.icns</string>
<key>CFBundleTypeName</key>
<string>QuickTime media</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>flac</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_flac.icns</string>
<key>CFBundleTypeName</key>
<string>Free Lossless Audio Codec (FLAC) audio</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mpeg</string>
<string>mpg</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_mp4.icns</string>
<key>CFBundleTypeName</key>
<string>MPEG video</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>mp4</string>
<string>m4v</string>
<string>m4b</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_mp4.icns</string>
<key>CFBundleTypeName</key>
<string>MPEG-4 video</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>dat</string>
<string>divx</string>
<string>vob</string>
<string>amv</string>
<string>mxf</string>
<string>mcf</string>
<string>swf</string>
<string>xvid</string>
<string>yuv</string>
<string>dv</string>
<string>wv</string>
<string>*</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_other_v.icns</string>
<key>CFBundleTypeName</key>
<string>Video file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>aa3</string>
<string>ac3</string>
<string>acm</string>
<string>aif</string>
<string>aiff</string>
<string>ape</string>
<string>caf</string>
<string>mid</string>
<string>midi</string>
<string>pcm</string>
<string>vox</string>
<string>tta</string>
<string>tak</string>
<string>opus</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_other_a.icns</string>
<key>CFBundleTypeName</key>
<string>Audio file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>m3u8</string>
<string>m3u</string>
<string>pls</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc_list.icns</string>
<key>CFBundleTypeName</key>
<string>Playlist</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
</array>
<key>NSServices</key>
<array>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Text Drop</string>
</dict>
<key>NSMessage</key>
<string>droppedText</string>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>
</array>
</dict>
</array>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,33 @@
//
// MainWindow.swift
// demo-macOS
//
// Created by kintan on 2018/10/29.
// Copyright © 2018 kintan. All rights reserved.
//
import Cocoa
import KSPlayer
class MainWindow: NSWindow {
let vc: ViewController
override init(contentRect: NSRect, styleMask style: NSWindow.StyleMask, backing backingStoreType: NSWindow.BackingStoreType, defer flag: Bool) {
KSOptions.firstPlayerType = KSMEPlayer.self
KSOptions.secondPlayerType = KSMEPlayer.self
KSOptions.logLevel = .debug
KSOptions.isAutoPlay = true
KSOptions.isSeekedAutoPlay = true
vc = ViewController()
super.init(contentRect: contentRect, styleMask: style, backing: backingStoreType, defer: flag)
contentViewController = vc
styleMask = [.closable, .miniaturizable, .resizable, .titled]
}
func open(url: URL) {
if !isVisible {
makeKeyAndOrderFront(self)
center()
}
vc.url = url
}
}

View File

@@ -0,0 +1,272 @@
//
// OpenURLWindowController.swift
// iina
//
// Created by Collider LI on 25/8/2018.
// Copyright © 2018 lhc. All rights reserved.
//
import Cocoa
class OpenURLWindowController: NSWindowController, NSTextFieldDelegate, NSControlTextEditingDelegate {
override var windowNibName: NSNib.Name {
NSNib.Name("OpenURLWindowController")
}
@IBOutlet var urlStackView: NSStackView!
@IBOutlet var httpPrefixTextField: NSTextField!
@IBOutlet var urlField: NSTextField!
@IBOutlet var usernameField: NSTextField!
@IBOutlet var passwordField: NSSecureTextField!
@IBOutlet var rememberPasswordCheckBox: NSButton!
@IBOutlet var errorMessageLabel: NSTextField!
@IBOutlet var openButton: NSButton!
var isAlternativeAction = false
override func windowDidLoad() {
super.windowDidLoad()
window?.isMovableByWindowBackground = true
window?.titlebarAppearsTransparent = true
window?.titleVisibility = .hidden
urlStackView.setVisibilityPriority(.notVisible, for: httpPrefixTextField)
urlField.delegate = self
for item in [.closeButton, .miniaturizeButton, .zoomButton] as [NSWindow.ButtonType] {
window?.standardWindowButton(item)?.isHidden = true
}
}
override func cancelOperation(_: Any?) {
window?.close()
}
func resetFields() {
urlField.stringValue = ""
usernameField.stringValue = ""
passwordField.stringValue = ""
rememberPasswordCheckBox.state = .on
urlStackView.setVisibilityPriority(.notVisible, for: httpPrefixTextField)
window?.makeFirstResponder(urlField)
}
@IBAction func cancelBtnAction(_: Any) {
window?.close()
}
@IBAction func openBtnAction(_: Any) {
if let url = getURL().url {
if rememberPasswordCheckBox.state == .on, let host = url.host {
try? KeychainAccess.write(username: usernameField.stringValue,
password: passwordField.stringValue,
forService: .httpAuth,
server: host,
port: url.port)
}
window?.close()
if let delegate = NSApplication.shared.delegate as? AppDelegate {
delegate.open(url: url)
}
} else {
Utility.showAlert("wrong_url_format")
}
}
private func getURL() -> (url: URL?, hasScheme: Bool) {
guard !urlField.stringValue.isEmpty else { return (nil, false) }
let username = usernameField.stringValue
let password = passwordField.stringValue
guard var urlValue = urlField.stringValue.addingPercentEncoding(withAllowedCharacters: .urlAllowed) else {
return (nil, false)
}
var hasScheme = true
if let url = URL(string: urlValue), url.scheme == nil {
urlValue = "http://" + urlValue
hasScheme = false
}
guard let nsurl = NSURL(string: urlValue)?.standardized, let urlComponents = NSURLComponents(url: nsurl, resolvingAgainstBaseURL: false) else { return (nil, false) }
if !username.isEmpty {
urlComponents.user = username
if !password.isEmpty {
urlComponents.password = password
}
}
return (urlComponents.url, hasScheme)
}
// NSControlTextEditingDelegate
func controlTextDidChange(_ obj: Notification) {
if let textView = obj.userInfo?["NSFieldEditor"] as? NSTextView, let str = textView.textStorage?.string, str.isEmpty {
errorMessageLabel.isHidden = true
urlStackView.setVisibilityPriority(.notVisible, for: httpPrefixTextField)
openButton.isEnabled = true
return
}
let (url, hasScheme) = getURL()
if let url, let host = url.host {
errorMessageLabel.isHidden = true
urlField.textColor = .labelColor
openButton.isEnabled = true
if hasScheme {
urlStackView.setVisibilityPriority(.notVisible, for: httpPrefixTextField)
} else {
urlStackView.setVisibilityPriority(.mustHold, for: httpPrefixTextField)
}
// find saved password
if let (username, password) = try? KeychainAccess.read(username: nil, forService: .httpAuth, server: host, port: url.port) {
usernameField.stringValue = username
passwordField.stringValue = password
} else {
usernameField.stringValue = ""
passwordField.stringValue = ""
}
} else {
urlField.textColor = .systemRed
errorMessageLabel.isHidden = false
urlStackView.setVisibilityPriority(.notVisible, for: httpPrefixTextField)
openButton.isEnabled = false
}
}
}
class KeychainAccess {
enum KeychainError: Error {
case noResult
case unhandledError(message: String)
case unexpectedData
}
struct ServiceName: RawRepresentable {
typealias RawValue = String
var rawValue: String
init(rawValue: String) {
self.rawValue = rawValue
}
init(_ rawValue: String) {
self.init(rawValue: rawValue)
}
static let openSubAccount = ServiceName(rawValue: "IINA OpenSubtitles Account")
static let httpAuth = ServiceName(rawValue: "IINA Saved HTTP Password")
}
static func write(username: String, password: String, forService serviceName: ServiceName, server: String? = nil, port: Int? = nil) throws {
let status: OSStatus
if let _ = try? read(username: username, forService: serviceName, server: nil, port: nil) {
// if password exists, try to update the password
var query: [String: Any] = [kSecAttrService as String: serviceName.rawValue]
if let server { query[kSecAttrServer as String] = server }
if let port { query[kSecAttrPort as String] = port }
query[kSecClass as String] = server == nil && port == nil ? kSecClassGenericPassword : kSecClassInternetPassword
// create attributes for updating
let passwordData = password.data(using: String.Encoding.utf8)!
let attributes: [String: Any] = [kSecAttrAccount as String: username,
kSecValueData as String: passwordData]
// update
status = SecItemUpdate(query as CFDictionary, attributes as CFDictionary)
} else {
// try to write the password
var query: [String: Any] = [kSecAttrService as String: serviceName.rawValue,
kSecAttrLabel as String: serviceName.rawValue,
kSecAttrAccount as String: username,
kSecValueData as String: password]
if let server { query[kSecAttrServer as String] = server }
if let port { query[kSecAttrPort as String] = port }
query[kSecClass as String] = server == nil && port == nil ? kSecClassGenericPassword : kSecClassInternetPassword
status = SecItemAdd(query as CFDictionary, nil)
}
// check result
guard status != errSecItemNotFound else { throw KeychainError.noResult }
guard status == errSecSuccess else {
let message = (SecCopyErrorMessageString(status, nil) as String?) ?? ""
throw KeychainError.unhandledError(message: message)
}
}
static func read(username: String?, forService serviceName: ServiceName, server: String? = nil, port: Int? = nil) throws -> (username: String, password: String) {
var query: [String: Any] = [kSecAttrService as String: serviceName.rawValue,
kSecMatchLimit as String: kSecMatchLimitOne,
kSecReturnAttributes as String: true,
kSecReturnData as String: true]
if let username { query[kSecAttrAccount as String] = username }
if let server { query[kSecAttrServer as String] = server }
if let port { query[kSecAttrPort as String] = port }
query[kSecClass as String] = server == nil && port == nil ? kSecClassGenericPassword : kSecClassInternetPassword
// initiate the search
var item: CFTypeRef?
let status = SecItemCopyMatching(query as CFDictionary, &item)
guard status != errSecItemNotFound else { throw KeychainError.noResult }
guard status == errSecSuccess else {
let message = (SecCopyErrorMessageString(status, nil) as String?) ?? ""
throw KeychainError.unhandledError(message: message)
}
// get data
guard let existingItem = item as? [String: Any],
let passwordData = existingItem[kSecValueData as String] as? Data,
let password = String(data: passwordData, encoding: String.Encoding.utf8),
let account = existingItem[kSecAttrAccount as String] as? String
else {
throw KeychainError.unexpectedData
}
return (account, password)
}
}
enum Utility {
static func showAlert(_ key: String, comment: String? = nil, arguments: [CVarArg]? = nil, style: NSAlert.Style = .critical, sheetWindow: NSWindow? = nil) {
let alert = NSAlert()
switch style {
case .critical:
alert.messageText = NSLocalizedString("alert.title_error", comment: "Error")
case .informational:
alert.messageText = NSLocalizedString("alert.title_info", comment: "Information")
case .warning:
alert.messageText = NSLocalizedString("alert.title_warning", comment: "Warning")
@unknown default:
break
}
var format: String
if let stringComment = comment {
format = NSLocalizedString("alert." + key, comment: stringComment)
} else {
format = NSLocalizedString("alert." + key, comment: key)
}
if let stringArguments = arguments {
alert.informativeText = String(format: format, arguments: stringArguments)
} else {
alert.informativeText = String(format: format)
}
alert.alertStyle = style
if let sheetWindow {
alert.beginSheetModal(for: sheetWindow)
} else {
alert.runModal()
}
}
}
extension CharacterSet {
static let urlAllowed: CharacterSet = {
var set = CharacterSet.urlHostAllowed
.union(.urlUserAllowed)
.union(.urlPasswordAllowed)
.union(.urlPathAllowed)
.union(.urlQueryAllowed)
.union(.urlFragmentAllowed)
set.insert(charactersIn: "%")
return set
}()
}

View File

@@ -0,0 +1,246 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="OpenURLWindowController" customModule="IINA" customModuleProvider="target">
<connections>
<outlet property="errorMessageLabel" destination="cCl-dx-rAP" id="PsQ-Xc-fWf"/>
<outlet property="httpPrefixTextField" destination="eo6-z2-yqh" id="vac-xq-4hq"/>
<outlet property="openButton" destination="bUw-Ua-E9U" id="8la-Az-aOD"/>
<outlet property="passwordField" destination="P8y-xt-YCV" id="luf-wj-Kmt"/>
<outlet property="rememberPasswordCheckBox" destination="NkO-nb-bTI" id="XRU-d9-JbB"/>
<outlet property="urlField" destination="H7k-7S-pad" id="Jz2-kb-EOh"/>
<outlet property="urlStackView" destination="cWl-pb-Ohf" id="Iuw-dG-7Yj"/>
<outlet property="usernameField" destination="AAr-OR-upR" id="Cq4-BP-oaE"/>
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenNone="YES"/>
<rect key="contentRect" x="1062" y="556" width="576" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="3840" height="1057"/>
<view key="contentView" wantsLayer="YES" misplaced="YES" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="576" height="270"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<visualEffectView appearanceType="inheritedVibrantLight" blendingMode="behindWindow" material="underWindowBackground" state="active" translatesAutoresizingMaskIntoConstraints="NO" id="X1z-XY-que">
<rect key="frame" x="0.0" y="0.0" width="579" height="256"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="top" spacing="4" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cWl-pb-Ohf">
<rect key="frame" x="16" y="216" width="547" height="24"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eo6-z2-yqh">
<rect key="frame" x="-2" y="0.0" width="59" height="24"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="http://" id="kqT-tD-Wzp">
<font key="font" metaFont="system" size="20"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="H7k-7S-pad">
<rect key="frame" x="57" y="0.0" width="492" height="24"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" focusRingType="none" placeholderString="Please enter the URL here……" id="XV7-VP-Ua2">
<font key="font" metaFont="system" size="20"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<outlet property="nextKeyView" destination="AAr-OR-upR" id="ffa-tn-kzC"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="24" id="oA2-k7-DLz"/>
</constraints>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bUw-Ua-E9U">
<rect key="frame" x="496" y="9" width="73" height="32"/>
<buttonCell key="cell" type="push" title="Open" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="8sC-lH-DOd">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
DQ
</string>
</buttonCell>
<connections>
<action selector="openBtnAction:" target="-2" id="Kjc-7q-M9P"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="B9e-iq-atc">
<rect key="frame" x="418" y="9" width="82" height="32"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="iNG-ee-EW6">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
Gw
</string>
</buttonCell>
<connections>
<action selector="cancelBtnAction:" target="-2" id="EhB-pE-plk"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="atI-YI-EWn">
<rect key="frame" x="22" y="175" width="139" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="HTTP Authentication" id="wxH-ic-Uug">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cCl-dx-rAP">
<rect key="frame" x="14" y="198" width="78" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" title="URL is invalid." id="gaI-DT-l2c">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<box title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="qud-MM-CKm">
<rect key="frame" x="21" y="57" width="537" height="112"/>
<view key="contentView" id="UGp-0p-kT0">
<rect key="frame" x="3" y="3" width="531" height="106"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EO0-B1-NEj">
<rect key="frame" x="14" y="76" width="58" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" title="Username" id="Q1z-9O-n4X">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="11C-SC-jkc">
<rect key="frame" x="270" y="76" width="55" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" title="Password" id="uM6-Bp-Wdk">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AAr-OR-upR">
<rect key="frame" x="16" y="46" width="240" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="i6U-Vn-OMz">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="P8y-xt-YCV">
<rect key="frame" x="272" y="46" width="239" height="22"/>
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="ub0-4i-uZc">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<allowedInputSourceLocales>
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
</allowedInputSourceLocales>
</secureTextFieldCell>
<connections>
<outlet property="nextKeyView" destination="AAr-OR-upR" id="ilu-Y6-atZ"/>
</connections>
</secureTextField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NkO-nb-bTI">
<rect key="frame" x="14" y="14" width="386" height="18"/>
<buttonCell key="cell" type="check" title="Remember username and password for this host in keychain" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="m0D-hR-3pr">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews>
<constraints>
<constraint firstItem="NkO-nb-bTI" firstAttribute="top" secondItem="AAr-OR-upR" secondAttribute="bottom" constant="16" id="7bM-Z7-MN0"/>
<constraint firstItem="AAr-OR-upR" firstAttribute="leading" secondItem="UGp-0p-kT0" secondAttribute="leading" constant="16" id="DBS-ij-CMO"/>
<constraint firstItem="AAr-OR-upR" firstAttribute="width" secondItem="P8y-xt-YCV" secondAttribute="width" id="EWq-rn-Tc4"/>
<constraint firstItem="P8y-xt-YCV" firstAttribute="top" secondItem="11C-SC-jkc" secondAttribute="bottom" constant="8" id="G6n-UA-M3G"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="11C-SC-jkc" secondAttribute="trailing" id="JBv-3h-ccU"/>
<constraint firstItem="NkO-nb-bTI" firstAttribute="leading" secondItem="UGp-0p-kT0" secondAttribute="leading" constant="16" id="MEN-Re-ZwA"/>
<constraint firstItem="P8y-xt-YCV" firstAttribute="firstBaseline" secondItem="AAr-OR-upR" secondAttribute="firstBaseline" id="NS4-ko-SBG"/>
<constraint firstItem="P8y-xt-YCV" firstAttribute="leading" secondItem="AAr-OR-upR" secondAttribute="trailing" constant="16" id="QZ0-cA-UwK"/>
<constraint firstItem="11C-SC-jkc" firstAttribute="leading" secondItem="P8y-xt-YCV" secondAttribute="leading" id="Qm5-U1-Myz"/>
<constraint firstItem="AAr-OR-upR" firstAttribute="top" secondItem="EO0-B1-NEj" secondAttribute="bottom" constant="8" id="RpX-3v-vz3"/>
<constraint firstAttribute="trailing" secondItem="P8y-xt-YCV" secondAttribute="trailing" constant="20" id="bqw-9o-Sn0"/>
<constraint firstItem="11C-SC-jkc" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="EO0-B1-NEj" secondAttribute="trailing" constant="16" id="hHV-3B-aTI"/>
<constraint firstItem="EO0-B1-NEj" firstAttribute="leading" secondItem="AAr-OR-upR" secondAttribute="leading" id="rIg-rF-XAc"/>
<constraint firstAttribute="bottom" secondItem="NkO-nb-bTI" secondAttribute="bottom" constant="16" id="rKX-Pt-Q3E"/>
<constraint firstItem="EO0-B1-NEj" firstAttribute="top" secondItem="UGp-0p-kT0" secondAttribute="top" constant="16" id="sOH-7L-hej"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="NkO-nb-bTI" secondAttribute="trailing" constant="16" id="zZN-Rr-lcH"/>
</constraints>
</view>
</box>
</subviews>
<constraints>
<constraint firstItem="atI-YI-EWn" firstAttribute="leading" secondItem="X1z-XY-que" secondAttribute="leading" constant="24" id="140-si-az8"/>
<constraint firstItem="cWl-pb-Ohf" firstAttribute="leading" secondItem="X1z-XY-que" secondAttribute="leading" constant="16" id="NDt-VE-GP3"/>
<constraint firstItem="atI-YI-EWn" firstAttribute="top" secondItem="cWl-pb-Ohf" secondAttribute="bottom" constant="24" id="NeK-m3-nZS"/>
<constraint firstAttribute="trailing" secondItem="qud-MM-CKm" secondAttribute="trailing" constant="24" id="OZq-1f-H6w"/>
<constraint firstAttribute="bottom" secondItem="bUw-Ua-E9U" secondAttribute="bottom" constant="16" id="SQO-h2-ADL"/>
<constraint firstAttribute="trailing" secondItem="bUw-Ua-E9U" secondAttribute="trailing" constant="16" id="UXp-Iy-h0A"/>
<constraint firstItem="cCl-dx-rAP" firstAttribute="leading" secondItem="cWl-pb-Ohf" secondAttribute="leading" id="YfV-XA-IcB"/>
<constraint firstItem="B9e-iq-atc" firstAttribute="firstBaseline" secondItem="bUw-Ua-E9U" secondAttribute="firstBaseline" id="aJP-wq-LQf"/>
<constraint firstItem="qud-MM-CKm" firstAttribute="top" secondItem="atI-YI-EWn" secondAttribute="bottom" constant="8" id="aSE-Zk-ndp"/>
<constraint firstItem="cCl-dx-rAP" firstAttribute="top" secondItem="cWl-pb-Ohf" secondAttribute="bottom" constant="4" id="gfM-Cv-7gx"/>
<constraint firstItem="cCl-dx-rAP" firstAttribute="trailing" relation="lessThanOrEqual" secondItem="cWl-pb-Ohf" secondAttribute="trailing" id="hCS-RN-v0g"/>
<constraint firstItem="bUw-Ua-E9U" firstAttribute="top" secondItem="qud-MM-CKm" secondAttribute="bottom" constant="24" id="mk1-1P-FBY"/>
<constraint firstItem="qud-MM-CKm" firstAttribute="leading" secondItem="X1z-XY-que" secondAttribute="leading" constant="24" id="qlr-tB-eyb"/>
<constraint firstItem="cWl-pb-Ohf" firstAttribute="top" secondItem="X1z-XY-que" secondAttribute="top" constant="16" id="sWy-6R-ljD"/>
<constraint firstItem="B9e-iq-atc" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="X1z-XY-que" secondAttribute="leading" constant="16" id="spF-kB-s1L"/>
<constraint firstItem="bUw-Ua-E9U" firstAttribute="leading" secondItem="B9e-iq-atc" secondAttribute="trailing" constant="8" id="tNl-gV-uSX"/>
<constraint firstAttribute="trailing" secondItem="cWl-pb-Ohf" secondAttribute="trailing" constant="16" id="y1Z-e7-Gjk"/>
</constraints>
</visualEffectView>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="X1z-XY-que" secondAttribute="trailing" id="Eyf-vR-YrS"/>
<constraint firstAttribute="bottom" secondItem="X1z-XY-que" secondAttribute="bottom" id="T34-vK-ECf"/>
<constraint firstItem="X1z-XY-que" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" id="Zzo-7D-h9G"/>
<constraint firstItem="X1z-XY-que" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" id="e5q-Il-ITO"/>
</constraints>
</view>
<connections>
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
</connections>
<point key="canvasLocation" x="158" y="171"/>
</window>
<secureTextField verticalHuggingPriority="750" id="a3w-Hu-aMP">
<rect key="frame" x="0.0" y="0.0" width="96" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="o6r-Zv-w8b">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<allowedInputSourceLocales>
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
</allowedInputSourceLocales>
</secureTextFieldCell>
<point key="canvasLocation" x="194" y="425"/>
</secureTextField>
<secureTextField verticalHuggingPriority="750" id="hjA-b6-vjs">
<rect key="frame" x="0.0" y="0.0" width="96" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="BAX-zD-Sub">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<allowedInputSourceLocales>
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
</allowedInputSourceLocales>
</secureTextFieldCell>
<point key="canvasLocation" x="113" y="428"/>
</secureTextField>
</objects>
</document>

View File

@@ -0,0 +1,52 @@
//
// ViewController.swift
// demo-macOS
//
// Created by kintan on 2018/5/24.
// Copyright © 2018 kintan. All rights reserved.
//
import AppKit
import KSPlayer
class ViewController: NSViewController {
private let playerView = MacVideoPlayerView()
var url: URL? {
didSet {
if let url {
let res0 = KSPlayerResourceDefinition(url: url, definition: "高清", options: KSOptions())
let asset = KSPlayerResource(name: url.lastPathComponent, definitions: [res0], cover: URL(string: "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Big_buck_bunny_poster_big.jpg/848px-Big_buck_bunny_poster_big.jpg"))
playerView.set(resource: asset)
} else {
playerView.resetPlayer()
}
}
}
init() {
super.init(nibName: nil, bundle: nil)
}
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(playerView)
playerView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
playerView.topAnchor.constraint(equalTo: view.topAnchor),
playerView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
playerView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
playerView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11134" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ViewController" customModuleProvider="target">
<connections>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
</objects>
</document>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>