Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| be0bd0211b | |||
| 3f6129964e | |||
| 352f7c8ad2 | |||
| 52781c2335 | |||
| 6adaab83d6 | |||
| 5d549ab629 | |||
| c54689bccc | |||
| 5ddc45e132 | |||
| 9bc2acc5f4 | |||
| d103720de4 | |||
| 09cd2cd79c | |||
| 4c2a062a71 | |||
| c70ed728d3 | |||
| 12a6cb6afe | |||
| 0a73d77643 | |||
| de2f2f2f29 | |||
| 54df55d873 | |||
| 5ea6de9f9c | |||
| 8333545660 | |||
| 4be5d991d6 | |||
| d0e5cfa4d6 | |||
| f9159b1121 | |||
| 2641ba660d | |||
| 2cebd10d55 | |||
| 5de3413003 | |||
| 1b189433da | |||
| 64efed6619 | |||
| 127d4cd6ab | |||
| b575f97bde | |||
| 315867ebb2 | |||
| cf4468cb36 | |||
| 9536f15b16 | |||
| 7538b3f2f4 | |||
| 19026b39f2 | |||
| 1e0dabd686 | |||
| 32f6a6d397 | |||
| 0523e2578c | |||
| 2e199eed4d | |||
| 4b50636ab8 | |||
| 4cef47a199 | |||
| 3707a7070d | |||
| f9659ddd83 | |||
| 4639c44b03 | |||
| 5d29531a64 |
+71
@@ -0,0 +1,71 @@
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData/
|
||||
|
||||
## Various settings
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata/
|
||||
|
||||
## Other
|
||||
*.moved-aside
|
||||
*.xccheckout
|
||||
*.xcscmblueprint
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.dSYM.zip
|
||||
*.dSYM
|
||||
|
||||
## Playgrounds
|
||||
timeline.xctimeline
|
||||
playground.xcworkspace
|
||||
|
||||
# Swift Package Manager
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
|
||||
# Packages/
|
||||
# Package.pins
|
||||
# Package.resolved
|
||||
.build/
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
# Pods/
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from the Xcode workspace
|
||||
# *.xcworkspace
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://docs.fastlane.tools/best-practices/source-control/#source-control
|
||||
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots/**/*.png
|
||||
fastlane/test_output
|
||||
@@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Oskar Groth
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -7,38 +7,42 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
750F2E3E1E5D2CD000C20E79 /* OGSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 750F2E3C1E5D2CD000C20E79 /* OGSwitch.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
750F2E451E5D2CE100C20E79 /* OGSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 750F2E441E5D2CE100C20E79 /* OGSwitch.swift */; };
|
||||
750F2E4D1E5D2D7100C20E79 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 750F2E4C1E5D2D7100C20E79 /* AppDelegate.swift */; };
|
||||
750F2E4F1E5D2D7100C20E79 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 750F2E4E1E5D2D7100C20E79 /* Assets.xcassets */; };
|
||||
750F2E521E5D2D7200C20E79 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 750F2E501E5D2D7200C20E79 /* MainMenu.xib */; };
|
||||
750F2E581E5D2F6300C20E79 /* OGSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 750F2E441E5D2CE100C20E79 /* OGSwitch.swift */; };
|
||||
75256FE220FA5ABC00ED6782 /* OGSwitch.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 75256FE120FA5ABC00ED6782 /* OGSwitch.framework */; };
|
||||
75256FE320FA5AC300ED6782 /* OGSwitch.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 75256FE120FA5ABC00ED6782 /* OGSwitch.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
7553A35A20F5045900EEA571 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
75256FE320FA5AC300ED6782 /* OGSwitch.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
750F2E391E5D2CD000C20E79 /* OGSwitch.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OGSwitch.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
750F2E3C1E5D2CD000C20E79 /* OGSwitch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OGSwitch.h; sourceTree = "<group>"; };
|
||||
750F2E3D1E5D2CD000C20E79 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
750F2E441E5D2CE100C20E79 /* OGSwitch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OGSwitch.swift; sourceTree = "<group>"; };
|
||||
750F2E4A1E5D2D7100C20E79 /* OGSwitchDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OGSwitchDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
750F2E4A1E5D2D7100C20E79 /* OGSwitch-DemoDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "OGSwitch-DemoDemo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
750F2E4C1E5D2D7100C20E79 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
750F2E4E1E5D2D7100C20E79 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
750F2E511E5D2D7200C20E79 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
750F2E531E5D2D7200C20E79 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
75256FE120FA5ABC00ED6782 /* OGSwitch.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = OGSwitch.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
750F2E351E5D2CD000C20E79 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
750F2E471E5D2D7100C20E79 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
75256FE220FA5ABC00ED6782 /* OGSwitch.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -48,31 +52,20 @@
|
||||
750F2E2F1E5D2CD000C20E79 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
750F2E3B1E5D2CD000C20E79 /* OGSwitch */,
|
||||
750F2E4B1E5D2D7100C20E79 /* OGSwitchDemo */,
|
||||
750F2E3A1E5D2CD000C20E79 /* Products */,
|
||||
75256FE020FA5ABC00ED6782 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
750F2E3A1E5D2CD000C20E79 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
750F2E391E5D2CD000C20E79 /* OGSwitch.framework */,
|
||||
750F2E4A1E5D2D7100C20E79 /* OGSwitchDemo.app */,
|
||||
750F2E4A1E5D2D7100C20E79 /* OGSwitch-DemoDemo.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
750F2E3B1E5D2CD000C20E79 /* OGSwitch */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
750F2E3C1E5D2CD000C20E79 /* OGSwitch.h */,
|
||||
750F2E441E5D2CE100C20E79 /* OGSwitch.swift */,
|
||||
750F2E3D1E5D2CD000C20E79 /* Info.plist */,
|
||||
);
|
||||
path = OGSwitch;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
750F2E4B1E5D2D7100C20E79 /* OGSwitchDemo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -84,53 +77,33 @@
|
||||
path = OGSwitchDemo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
75256FE020FA5ABC00ED6782 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
75256FE120FA5ABC00ED6782 /* OGSwitch.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
750F2E361E5D2CD000C20E79 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
750F2E3E1E5D2CD000C20E79 /* OGSwitch.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
750F2E381E5D2CD000C20E79 /* OGSwitch */ = {
|
||||
750F2E491E5D2D7100C20E79 /* OGSwitch-DemoDemo */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 750F2E411E5D2CD000C20E79 /* Build configuration list for PBXNativeTarget "OGSwitch" */;
|
||||
buildPhases = (
|
||||
750F2E341E5D2CD000C20E79 /* Sources */,
|
||||
750F2E351E5D2CD000C20E79 /* Frameworks */,
|
||||
750F2E361E5D2CD000C20E79 /* Headers */,
|
||||
750F2E371E5D2CD000C20E79 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = OGSwitch;
|
||||
productName = OGSwitch;
|
||||
productReference = 750F2E391E5D2CD000C20E79 /* OGSwitch.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
750F2E491E5D2D7100C20E79 /* OGSwitchDemo */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 750F2E541E5D2D7200C20E79 /* Build configuration list for PBXNativeTarget "OGSwitchDemo" */;
|
||||
buildConfigurationList = 750F2E541E5D2D7200C20E79 /* Build configuration list for PBXNativeTarget "OGSwitch-DemoDemo" */;
|
||||
buildPhases = (
|
||||
750F2E461E5D2D7100C20E79 /* Sources */,
|
||||
750F2E471E5D2D7100C20E79 /* Frameworks */,
|
||||
750F2E481E5D2D7100C20E79 /* Resources */,
|
||||
7553A35A20F5045900EEA571 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = OGSwitchDemo;
|
||||
name = "OGSwitch-DemoDemo";
|
||||
productName = OGSwitchDemo;
|
||||
productReference = 750F2E4A1E5D2D7100C20E79 /* OGSwitchDemo.app */;
|
||||
productReference = 750F2E4A1E5D2D7100C20E79 /* OGSwitch-DemoDemo.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
@@ -140,23 +113,18 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0820;
|
||||
LastUpgradeCheck = 0820;
|
||||
LastUpgradeCheck = 1000;
|
||||
ORGANIZATIONNAME = "Oskar Groth";
|
||||
TargetAttributes = {
|
||||
750F2E381E5D2CD000C20E79 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = ZQK6SX26CE;
|
||||
LastSwiftMigration = 0820;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
750F2E491E5D2D7100C20E79 = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
DevelopmentTeam = ZQK6SX26CE;
|
||||
LastSwiftMigration = 0910;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 750F2E331E5D2CD000C20E79 /* Build configuration list for PBXProject "OGSwitch" */;
|
||||
buildConfigurationList = 750F2E331E5D2CD000C20E79 /* Build configuration list for PBXProject "OGSwitch-Demo" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
@@ -169,20 +137,12 @@
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
750F2E381E5D2CD000C20E79 /* OGSwitch */,
|
||||
750F2E491E5D2D7100C20E79 /* OGSwitchDemo */,
|
||||
750F2E491E5D2D7100C20E79 /* OGSwitch-DemoDemo */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
750F2E371E5D2CD000C20E79 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
750F2E481E5D2D7100C20E79 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -195,20 +155,11 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
750F2E341E5D2CD000C20E79 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
750F2E451E5D2CE100C20E79 /* OGSwitch.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
750F2E461E5D2D7100C20E79 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
750F2E4D1E5D2D7100C20E79 /* AppDelegate.swift in Sources */,
|
||||
750F2E581E5D2F6300C20E79 /* OGSwitch.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -235,15 +186,23 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = 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_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -267,12 +226,14 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
@@ -287,15 +248,23 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = 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_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -313,92 +282,55 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
750F2E421E5D2CD000C20E79 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = ZQK6SX26CE;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = OGSwitch/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cindori.OGSwitch;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
750F2E431E5D2CD000C20E79 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = ZQK6SX26CE;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = OGSwitch/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cindori.OGSwitch;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
750F2E551E5D2D7200C20E79 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = ZQK6SX26CE;
|
||||
INFOPLIST_FILE = OGSwitchDemo/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cindori.OGSwitchDemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
750F2E561E5D2D7200C20E79 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = ZQK6SX26CE;
|
||||
INFOPLIST_FILE = OGSwitchDemo/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cindori.OGSwitchDemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
750F2E331E5D2CD000C20E79 /* Build configuration list for PBXProject "OGSwitch" */ = {
|
||||
750F2E331E5D2CD000C20E79 /* Build configuration list for PBXProject "OGSwitch-Demo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
750F2E3F1E5D2CD000C20E79 /* Debug */,
|
||||
@@ -407,21 +339,14 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
750F2E411E5D2CD000C20E79 /* Build configuration list for PBXNativeTarget "OGSwitch" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
750F2E421E5D2CD000C20E79 /* Debug */,
|
||||
750F2E431E5D2CD000C20E79 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
750F2E541E5D2D7200C20E79 /* Build configuration list for PBXNativeTarget "OGSwitchDemo" */ = {
|
||||
750F2E541E5D2D7200C20E79 /* Build configuration list for PBXNativeTarget "OGSwitch-DemoDemo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
750F2E551E5D2D7200C20E79 /* Debug */,
|
||||
750F2E561E5D2D7200C20E79 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
@@ -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>
|
||||
BIN
Binary file not shown.
+5
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
</Bucket>
|
||||
+13
-13
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0820"
|
||||
LastUpgradeVersion = "1000"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -15,9 +15,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "750F2E491E5D2D7100C20E79"
|
||||
BuildableName = "OGSwitchDemo.app"
|
||||
BlueprintName = "OGSwitchDemo"
|
||||
ReferencedContainer = "container:OGSwitch.xcodeproj">
|
||||
BuildableName = "OGSwitch-DemoDemo.app"
|
||||
BlueprintName = "OGSwitch-DemoDemo"
|
||||
ReferencedContainer = "container:OGSwitch-Demo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
@@ -33,9 +33,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "750F2E491E5D2D7100C20E79"
|
||||
BuildableName = "OGSwitchDemo.app"
|
||||
BlueprintName = "OGSwitchDemo"
|
||||
ReferencedContainer = "container:OGSwitch.xcodeproj">
|
||||
BuildableName = "OGSwitch-DemoDemo.app"
|
||||
BlueprintName = "OGSwitch-DemoDemo"
|
||||
ReferencedContainer = "container:OGSwitch-Demo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
@@ -56,9 +56,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "750F2E491E5D2D7100C20E79"
|
||||
BuildableName = "OGSwitchDemo.app"
|
||||
BlueprintName = "OGSwitchDemo"
|
||||
ReferencedContainer = "container:OGSwitch.xcodeproj">
|
||||
BuildableName = "OGSwitch-DemoDemo.app"
|
||||
BlueprintName = "OGSwitch-DemoDemo"
|
||||
ReferencedContainer = "container:OGSwitch-Demo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
@@ -75,9 +75,9 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "750F2E491E5D2D7100C20E79"
|
||||
BuildableName = "OGSwitchDemo.app"
|
||||
BlueprintName = "OGSwitchDemo"
|
||||
ReferencedContainer = "container:OGSwitch.xcodeproj">
|
||||
BuildableName = "OGSwitch-DemoDemo.app"
|
||||
BlueprintName = "OGSwitch-DemoDemo"
|
||||
ReferencedContainer = "container:OGSwitch-Demo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
+1
-6
@@ -4,15 +4,10 @@
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>OGSwitch.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>OGSwitchDemo.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:/Users/oskar/Dev/OGSwitch/OGSwitch-Demo.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:OGSwitch/OGSwitch.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -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>
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,346 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
75256FDF20FA5A3E00ED6782 /* OGSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75256FDE20FA5A3E00ED6782 /* OGSwitch.swift */; };
|
||||
753FF1A520FA64B500DFA33E /* OGSwitch.swift in Headers */ = {isa = PBXBuildFile; fileRef = 75256FDE20FA5A3E00ED6782 /* OGSwitch.swift */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
753FF1A620FA64D200DFA33E /* OGSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 75256FD620FA5A0E00ED6782 /* OGSwitch.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
75256FD320FA5A0E00ED6782 /* OGSwitch.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OGSwitch.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
75256FD620FA5A0E00ED6782 /* OGSwitch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OGSwitch.h; sourceTree = "<group>"; };
|
||||
75256FD720FA5A0E00ED6782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
75256FDE20FA5A3E00ED6782 /* OGSwitch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OGSwitch.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
75256FD020FA5A0E00ED6782 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
75256FC920FA5A0E00ED6782 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
75256FD520FA5A0E00ED6782 /* OGSwitch */,
|
||||
75256FD420FA5A0E00ED6782 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
75256FD420FA5A0E00ED6782 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
75256FD320FA5A0E00ED6782 /* OGSwitch.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
75256FD520FA5A0E00ED6782 /* OGSwitch */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
75256FDE20FA5A3E00ED6782 /* OGSwitch.swift */,
|
||||
75256FD620FA5A0E00ED6782 /* OGSwitch.h */,
|
||||
75256FD720FA5A0E00ED6782 /* Info.plist */,
|
||||
);
|
||||
path = OGSwitch;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
75256FCE20FA5A0E00ED6782 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
753FF1A620FA64D200DFA33E /* OGSwitch.h in Headers */,
|
||||
753FF1A520FA64B500DFA33E /* OGSwitch.swift in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
75256FD220FA5A0E00ED6782 /* OGSwitch */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 75256FDB20FA5A0E00ED6782 /* Build configuration list for PBXNativeTarget "OGSwitch" */;
|
||||
buildPhases = (
|
||||
75256FCE20FA5A0E00ED6782 /* Headers */,
|
||||
75256FCF20FA5A0E00ED6782 /* Sources */,
|
||||
75256FD020FA5A0E00ED6782 /* Frameworks */,
|
||||
75256FD120FA5A0E00ED6782 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = OGSwitch;
|
||||
productName = OGSwitch;
|
||||
productReference = 75256FD320FA5A0E00ED6782 /* OGSwitch.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
75256FCA20FA5A0E00ED6782 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1000;
|
||||
ORGANIZATIONNAME = "Oskar Groth";
|
||||
TargetAttributes = {
|
||||
75256FD220FA5A0E00ED6782 = {
|
||||
CreatedOnToolsVersion = 10.0;
|
||||
LastSwiftMigration = 1000;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 75256FCD20FA5A0E00ED6782 /* Build configuration list for PBXProject "OGSwitch" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 75256FC920FA5A0E00ED6782;
|
||||
productRefGroup = 75256FD420FA5A0E00ED6782 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
75256FD220FA5A0E00ED6782 /* OGSwitch */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
75256FD120FA5A0E00ED6782 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
75256FCF20FA5A0E00ED6782 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
75256FDF20FA5A3E00ED6782 /* OGSwitch.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
75256FD920FA5A0E00ED6782 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
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_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 = "Mac Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
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.14;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
75256FDA20FA5A0E00ED6782 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
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_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 = "Mac Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
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.14;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
75256FDC20FA5A0E00ED6782 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = ZQK6SX26CE;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = OGSwitch/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cindori.OGSwitch;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
75256FDD20FA5A0E00ED6782 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = ZQK6SX26CE;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = OGSwitch/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cindori.OGSwitch;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
75256FCD20FA5A0E00ED6782 /* Build configuration list for PBXProject "OGSwitch" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
75256FD920FA5A0E00ED6782 /* Debug */,
|
||||
75256FDA20FA5A0E00ED6782 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
75256FDB20FA5A0E00ED6782 /* Build configuration list for PBXNativeTarget "OGSwitch" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
75256FDC20FA5A0E00ED6782 /* Debug */,
|
||||
75256FDD20FA5A0E00ED6782 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 75256FCA20FA5A0E00ED6782 /* Project object */;
|
||||
}
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0820"
|
||||
LastUpgradeVersion = "1000"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -14,7 +14,7 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "750F2E381E5D2CD000C20E79"
|
||||
BlueprintIdentifier = "75256FD220FA5A0E00ED6782"
|
||||
BuildableName = "OGSwitch.framework"
|
||||
BlueprintName = "OGSwitch"
|
||||
ReferencedContainer = "container:OGSwitch.xcodeproj">
|
||||
@@ -45,7 +45,7 @@
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "750F2E381E5D2CD000C20E79"
|
||||
BlueprintIdentifier = "75256FD220FA5A0E00ED6782"
|
||||
BuildableName = "OGSwitch.framework"
|
||||
BlueprintName = "OGSwitch"
|
||||
ReferencedContainer = "container:OGSwitch.xcodeproj">
|
||||
@@ -63,7 +63,7 @@
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "750F2E381E5D2CD000C20E79"
|
||||
BlueprintIdentifier = "75256FD220FA5A0E00ED6782"
|
||||
BuildableName = "OGSwitch.framework"
|
||||
BlueprintName = "OGSwitch"
|
||||
ReferencedContainer = "container:OGSwitch.xcodeproj">
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<?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>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>OGSwitch.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -19,8 +19,6 @@
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2017 Oskar Groth. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
<string>Copyright © 2018 Oskar Groth. All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -2,8 +2,8 @@
|
||||
// OGSwitch.h
|
||||
// OGSwitch
|
||||
//
|
||||
// Created by Oskar Groth on 2017-02-22.
|
||||
// Copyright © 2017 Oskar Groth. All rights reserved.
|
||||
// Created by Oskar Groth on 2018-07-14.
|
||||
// Copyright © 2018 Oskar Groth. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
@@ -13,7 +13,3 @@ FOUNDATION_EXPORT double OGSwitchVersionNumber;
|
||||
|
||||
//! Project version string for OGSwitch.
|
||||
FOUNDATION_EXPORT const unsigned char OGSwitchVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <OGSwitch/PublicHeader.h>
|
||||
|
||||
|
||||
@@ -9,21 +9,64 @@
|
||||
import Cocoa
|
||||
import QuartzCore
|
||||
|
||||
public class OGSwitch : NSControl {
|
||||
//Can not be NSControl due to 10.9 issues: https://github.com/iluuu1994/ITSwitch/issues/21
|
||||
|
||||
@IBInspectable public var tintColor: NSColor = NSColor(calibratedRed:0.27, green: 0.86, blue: 0.36, alpha: 1.0)
|
||||
@IBInspectable public var knobBackgroundColor: NSColor = NSColor(calibratedWhite:1.0, alpha: 1.0)
|
||||
@IBInspectable public var disabledBorderColor: NSColor = NSColor(calibratedWhite: 0.0, alpha: 0.2)
|
||||
@IBInspectable public var disabledBackgroundColor: NSColor = NSColor.clear
|
||||
@IBInspectable public var inactiveBackgroundColor: NSColor = NSColor(calibratedWhite: 0.0, alpha:0.3)
|
||||
@IBDesignable public class OGSwitch: NSControl {
|
||||
|
||||
@IBInspectable public var tintColor: NSColor = NSColor(calibratedRed:0.27, green: 0.86, blue: 0.36, alpha: 1.0) {
|
||||
didSet {
|
||||
reloadLayer()
|
||||
}
|
||||
}
|
||||
@IBInspectable public var knobBackgroundColor: NSColor = NSColor(calibratedWhite:1.0, alpha: 1.0) {
|
||||
didSet {
|
||||
reloadLayer()
|
||||
}
|
||||
}
|
||||
@IBInspectable public var disabledBorderColor: NSColor = NSColor(calibratedWhite: 0.0, alpha: 0.2) {
|
||||
didSet {
|
||||
reloadLayer()
|
||||
}
|
||||
}
|
||||
@IBInspectable public var disabledBackgroundColor: NSColor = NSColor.clear {
|
||||
didSet {
|
||||
reloadLayer()
|
||||
}
|
||||
}
|
||||
@IBInspectable public var inactiveBackgroundColor: NSColor = NSColor(calibratedWhite: 0.0, alpha:0.3) {
|
||||
didSet {
|
||||
reloadLayer()
|
||||
}
|
||||
}
|
||||
@IBInspectable public var animationDuration: TimeInterval = 0.4
|
||||
@IBInspectable public var inactiveIcon: NSImage? {
|
||||
didSet {
|
||||
reloadLayer()
|
||||
}
|
||||
}
|
||||
@IBInspectable public var activeIcon: NSImage? {
|
||||
didSet {
|
||||
reloadLayer()
|
||||
}
|
||||
}
|
||||
@IBInspectable public var ignoreRatio: Bool = false {
|
||||
didSet {
|
||||
reloadLayer()
|
||||
}
|
||||
}
|
||||
override public var isEnabled: Bool {
|
||||
didSet {
|
||||
reloadLayerAnimated(animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
let kBorderLineWidth:CGFloat = 1.0
|
||||
let kGoldenRatio:CGFloat = 1.6180339875
|
||||
let kDecreasedGoldenRatio:CGFloat = 1.38
|
||||
let kEnabledOpacity:Float = 1.0
|
||||
let kDisabledOpacity:Float = 0.5
|
||||
public var isOn:Bool = true
|
||||
var dragEvents = 0
|
||||
public var isOn:Bool = false
|
||||
public var isActive:Bool = false
|
||||
public var hasDragged:Bool = false
|
||||
public var isDraggingTowardsOn:Bool = false
|
||||
@@ -31,6 +74,8 @@ public class OGSwitch : NSControl {
|
||||
public var backgroundLayer:CALayer?
|
||||
public var knobLayer: CALayer?
|
||||
public var knobInsideLayer: CALayer?
|
||||
public var iconLayer = CALayer()
|
||||
public var lockInteraction: Bool = false
|
||||
|
||||
override public var acceptsFirstResponder: Bool {
|
||||
get {
|
||||
@@ -40,32 +85,64 @@ public class OGSwitch : NSControl {
|
||||
|
||||
required public init?(coder:NSCoder) {
|
||||
super.init(coder: coder)
|
||||
|
||||
setup()
|
||||
}
|
||||
|
||||
override init(frame:NSRect) {
|
||||
super.init(frame: frame);
|
||||
|
||||
setup()
|
||||
}
|
||||
|
||||
override public func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
reloadLayerSize()
|
||||
reloadLayer()
|
||||
setupIcon()
|
||||
}
|
||||
|
||||
internal func setup() {
|
||||
isEnabled = true
|
||||
setupLayers()
|
||||
}
|
||||
|
||||
public func setOn(isOn: Bool, animated: Bool) {
|
||||
if self.isOn != isOn {
|
||||
self.isOn = isOn
|
||||
reloadLayerAnimated(animated: animated)
|
||||
}
|
||||
}
|
||||
|
||||
internal func setupIcon() {
|
||||
guard let icon = inactiveIcon, let bounds = knobLayer?.bounds else {
|
||||
return
|
||||
}
|
||||
let size = icon.size
|
||||
iconLayer.frame = NSMakeRect((bounds.width-size.width)/2, (bounds.height-size.height)/2, size.width, size.height)
|
||||
iconLayer.contents = icon
|
||||
}
|
||||
|
||||
internal func animateImage() {
|
||||
let animation = CABasicAnimation(keyPath: "contents")
|
||||
animation.toValue = isOn ? activeIcon : inactiveIcon
|
||||
animation.fromValue = iconLayer.contents
|
||||
animation.duration = 0.5
|
||||
animation.isRemovedOnCompletion = false
|
||||
animation.fillMode = .forwards
|
||||
iconLayer.add(animation, forKey: "contents")
|
||||
iconLayer.setValue(animation.toValue, forKey: "contents")
|
||||
}
|
||||
|
||||
internal func setupLayers() {
|
||||
rootLayer = CALayer()
|
||||
layer = rootLayer
|
||||
|
||||
wantsLayer = true
|
||||
|
||||
layer?.masksToBounds = false
|
||||
backgroundLayer = CALayer()
|
||||
backgroundLayer!.autoresizingMask = [.layerWidthSizable, .layerHeightSizable]
|
||||
backgroundLayer!.bounds = rootLayer!.bounds
|
||||
backgroundLayer!.anchorPoint = CGPoint(x: 0.0, y: 0.0)
|
||||
backgroundLayer!.borderWidth = kBorderLineWidth
|
||||
backgroundLayer?.masksToBounds = false
|
||||
|
||||
rootLayer!.addSublayer(backgroundLayer!)
|
||||
|
||||
@@ -77,12 +154,16 @@ public class OGSwitch : NSControl {
|
||||
knobLayer!.shadowOffset = CGSize(width:0.0, height:-2.0)
|
||||
knobLayer!.shadowRadius = 1.0
|
||||
knobLayer!.shadowOpacity = 0.3
|
||||
knobLayer?.masksToBounds = false
|
||||
rootLayer!.addSublayer(knobLayer!)
|
||||
|
||||
knobInsideLayer = CALayer()
|
||||
knobInsideLayer!.frame = knobLayer!.bounds
|
||||
knobInsideLayer!.autoresizingMask = [.layerHeightSizable, .layerWidthSizable]
|
||||
|
||||
iconLayer = CALayer()
|
||||
knobInsideLayer?.addSublayer(iconLayer)
|
||||
|
||||
knobInsideLayer!.shadowColor = NSColor.black.cgColor
|
||||
knobInsideLayer!.shadowOffset = CGSize(width:0.0, height:0.0)
|
||||
knobInsideLayer!.backgroundColor = NSColor.white.cgColor
|
||||
@@ -97,36 +178,32 @@ public class OGSwitch : NSControl {
|
||||
internal func reloadLayerSize() {
|
||||
CATransaction.begin()
|
||||
CATransaction.setDisableActions(true)
|
||||
|
||||
knobLayer!.frame = rectForKnob()
|
||||
knobInsideLayer!.frame = knobLayer!.bounds
|
||||
|
||||
backgroundLayer!.cornerRadius = backgroundLayer!.bounds.size.height / 2.0
|
||||
knobLayer!.cornerRadius = knobLayer!.bounds.size.height / 2.0
|
||||
knobInsideLayer!.cornerRadius = knobLayer!.bounds.size.height / 2.0
|
||||
|
||||
CATransaction.commit()
|
||||
}
|
||||
|
||||
public func reloadLayerAnimated(animated: Bool) {
|
||||
guard let backgroundLayer = backgroundLayer else {
|
||||
return
|
||||
}
|
||||
CATransaction.begin()
|
||||
CATransaction.setAnimationDuration(animated ? animationDuration : 0)
|
||||
|
||||
if (hasDragged && isDraggingTowardsOn) || (!hasDragged && isOn) {
|
||||
backgroundLayer!.borderColor = tintColor.cgColor
|
||||
backgroundLayer!.backgroundColor = tintColor.cgColor
|
||||
backgroundLayer.borderColor = tintColor.cgColor
|
||||
backgroundLayer.backgroundColor = tintColor.cgColor
|
||||
}
|
||||
else {
|
||||
backgroundLayer!.borderColor = disabledBorderColor.cgColor
|
||||
backgroundLayer!.backgroundColor = disabledBackgroundColor.cgColor
|
||||
backgroundLayer.borderColor = disabledBorderColor.cgColor
|
||||
backgroundLayer.backgroundColor = disabledBackgroundColor.cgColor
|
||||
}
|
||||
|
||||
if isEnabled {
|
||||
rootLayer!.opacity = kEnabledOpacity
|
||||
}
|
||||
else {
|
||||
rootLayer!.opacity = kDisabledOpacity
|
||||
}
|
||||
knobLayer?.shadowColor = isEnabled ? NSColor.black.cgColor : NSColor.clear.cgColor
|
||||
rootLayer!.opacity = isEnabled ? kEnabledOpacity : kDisabledOpacity
|
||||
|
||||
if hasDragged {
|
||||
let function = CAMediaTimingFunction(controlPoints: 0.25, 1.5, 0.5, 1)
|
||||
@@ -137,6 +214,7 @@ public class OGSwitch : NSControl {
|
||||
knobInsideLayer!.frame = knobLayer!.bounds
|
||||
|
||||
CATransaction.commit()
|
||||
animateImage()
|
||||
}
|
||||
|
||||
public func reloadLayer() {
|
||||
@@ -152,12 +230,15 @@ public class OGSwitch : NSControl {
|
||||
var width = 0.0
|
||||
|
||||
let bounds: CGRect = backgroundLayer!.bounds
|
||||
|
||||
if isActive {
|
||||
width = Double((bounds.width - 2.0 * kBorderLineWidth) / kGoldenRatio)
|
||||
}
|
||||
else {
|
||||
width = Double((bounds.width - 2.0 * kBorderLineWidth) / kDecreasedGoldenRatio)
|
||||
if ignoreRatio {
|
||||
width = Double(height)
|
||||
} else {
|
||||
if isActive {
|
||||
width = Double((bounds.width - 2.0 * kBorderLineWidth) / kGoldenRatio)
|
||||
}
|
||||
else {
|
||||
width = Double((bounds.width - 2.0 * kBorderLineWidth) / kDecreasedGoldenRatio)
|
||||
}
|
||||
}
|
||||
|
||||
var x:CGFloat = 0
|
||||
@@ -183,7 +264,7 @@ public class OGSwitch : NSControl {
|
||||
|
||||
|
||||
override public func mouseDown(with theEvent: NSEvent) {
|
||||
if !isEnabled {
|
||||
if !isEnabled || lockInteraction {
|
||||
return
|
||||
}
|
||||
isActive = true
|
||||
@@ -191,10 +272,14 @@ public class OGSwitch : NSControl {
|
||||
}
|
||||
|
||||
override public func mouseDragged(with theEvent: NSEvent) {
|
||||
if !isEnabled {
|
||||
dragEvents += 1
|
||||
guard dragEvents > 3 else {
|
||||
return
|
||||
}
|
||||
dragEvents = 0
|
||||
if !isEnabled || lockInteraction {
|
||||
return
|
||||
}
|
||||
|
||||
hasDragged = true
|
||||
|
||||
let draggingPoint = convert(theEvent.locationInWindow, from: nil)
|
||||
@@ -203,7 +288,8 @@ public class OGSwitch : NSControl {
|
||||
}
|
||||
|
||||
override public func mouseUp(with theEvent: NSEvent) {
|
||||
if !isEnabled {
|
||||
dragEvents = 0
|
||||
if !isEnabled || lockInteraction {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -217,14 +303,14 @@ public class OGSwitch : NSControl {
|
||||
}
|
||||
|
||||
if isOn != on {
|
||||
Swift.print("Now: \(on)")
|
||||
isOn = on
|
||||
if action != nil {
|
||||
NSApp.sendAction(action!, to: target, from: self)
|
||||
}
|
||||
} else {
|
||||
isOn = on
|
||||
}
|
||||
|
||||
isOn = on
|
||||
|
||||
hasDragged = false
|
||||
isDraggingTowardsOn = false
|
||||
|
||||
@@ -232,3 +318,4 @@ public class OGSwitch : NSControl {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import OGSwitch
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
@IBOutlet weak var window: NSWindow!
|
||||
|
||||
@IBOutlet weak var switchButton: OGSwitch!
|
||||
|
||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||
// Insert code here to initialize your application
|
||||
@@ -22,6 +23,15 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
// Insert code here to tear down your application
|
||||
}
|
||||
|
||||
@IBAction func switchPress(_ sender: Any) {
|
||||
NSLog("Switch is now: \((sender as! OGSwitch).isOn)")
|
||||
// perform(#selector(timer), with: nil, afterDelay: 3)
|
||||
}
|
||||
|
||||
@objc func timer() {
|
||||
NSLog("Switch is after timer trigger now: \(switchButton.isOn)")
|
||||
// switchButton.setOn(isOn: !switchButton.isOn, animated: false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "checkmark.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "checkmark@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14269.12" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14269.12"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -13,19 +13,20 @@
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="OGSwitchDemo" customModuleProvider="target">
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="OGSwitch_DemoDemo" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="switchButton" destination="M7z-uc-a7v" id="s1F-OI-IzO"/>
|
||||
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||
<items>
|
||||
<menuItem title="OGSwitchDemo" id="1Xt-HY-uBw">
|
||||
<menuItem title="OGSwitch-DemoDemo" id="1Xt-HY-uBw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="OGSwitchDemo" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<menu key="submenu" title="OGSwitch-DemoDemo" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<items>
|
||||
<menuItem title="About OGSwitchDemo" id="5kV-Vb-QxS">
|
||||
<menuItem title="About OGSwitch-DemoDemo" id="5kV-Vb-QxS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
|
||||
@@ -39,7 +40,7 @@
|
||||
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
|
||||
<menuItem title="Hide OGSwitchDemo" keyEquivalent="h" id="Olw-nP-bQN">
|
||||
<menuItem title="Hide OGSwitch-DemoDemo" keyEquivalent="h" id="Olw-nP-bQN">
|
||||
<connections>
|
||||
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
|
||||
</connections>
|
||||
@@ -57,7 +58,7 @@
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
||||
<menuItem title="Quit OGSwitchDemo" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<menuItem title="Quit OGSwitch-DemoDemo" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<connections>
|
||||
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
|
||||
</connections>
|
||||
@@ -670,7 +671,7 @@
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||
<items>
|
||||
<menuItem title="OGSwitchDemo Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||
<menuItem title="OGSwitch-DemoDemo Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||
<connections>
|
||||
<action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
|
||||
</connections>
|
||||
@@ -680,21 +681,49 @@
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
<window title="OGSwitchDemo" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
|
||||
<window title="OGSwitch-Demo" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="335" y="390" width="480" height="360"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
|
||||
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ME7-To-eFM" customClass="OGSwitch" customModule="OGSwitchDemo" customModuleProvider="target">
|
||||
<rect key="frame" x="159" y="144" width="163" height="96"/>
|
||||
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="M7z-uc-a7v" customClass="OGSwitch" customModule="OGSwitch">
|
||||
<rect key="frame" x="159" y="201" width="163" height="96"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="ignoreRatio" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="disabledBackgroundColor">
|
||||
<color key="value" name="systemGreenColor" catalog="System" colorSpace="catalog"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="switchPress:" target="Voe-Tx-rLC" id="Mqi-G6-fmv"/>
|
||||
</connections>
|
||||
</customView>
|
||||
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Brb-kf-Oxi" customClass="OGSwitch" customModule="OGSwitch">
|
||||
<rect key="frame" x="159" y="63" width="163" height="96"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="image" keyPath="activeIcon" value="checkmark"/>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="ignoreRatio" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="disabledBackgroundColor">
|
||||
<color key="value" red="1" green="0.40000000600000002" blue="0.40000000600000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="image" keyPath="inactiveIcon" value="checkmark"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="switchPress:" target="Voe-Tx-rLC" id="tTg-hX-q3I"/>
|
||||
</connections>
|
||||
</customView>
|
||||
</subviews>
|
||||
</view>
|
||||
<point key="canvasLocation" x="198" y="-127"/>
|
||||
</window>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="checkmark" width="35" height="34"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
OGSwitch
|
||||
==================
|
||||
|
||||
Layer based Switch Control for macOS, with Interface Builder styling options. Written in Swift.
|
||||
|
||||
Supports animation, custom aspect ratios, and knob images.
|
||||
|
||||
This is a `NSView` subclass that lets you create beautiful iOS-inspired switches easily.
|
||||
|
||||

|
||||
|
||||
`OGSwitch` now also supports `IBDesignable` and renders directly in Interface Builder:
|
||||
|
||||

|
||||
|
||||
|
||||
## Installation (Carthage)
|
||||
Configure your Cartfile to use `OGSwitch`:
|
||||
|
||||
```github "OskarGroth/OGSwitch" ~> 2.0```
|
||||
|
||||
`OGSwitch` requires Swift 4.2.
|
||||
|
||||
## Usage
|
||||
|
||||
Create a custom `NSView` in Interface Builder and set it's class to `OGSwitch`.
|
||||
You can now style your switch from the inspector:
|
||||
|
||||

|
||||
|
||||
The same values can be accessed from your code.
|
||||
|
||||
## Credits
|
||||
|
||||
Inspired by ITSwitch by Ilija Tovilo.
|
||||
|
||||
## License
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Oskar Groth
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
Reference in New Issue
Block a user