21 Commits

Author SHA1 Message Date
Oskar a4e1d06b19 Public inits 2018-08-08 21:41:57 +02:00
Oskar 79209bca05 Merge branch 'master' of https://github.com/OskarGroth/OGSwitch 2018-08-08 21:32:10 +02:00
Oskar 2004091f18 Improve border and add size classes 2018-08-08 21:32:00 +02:00
Oskar Groth be0bd0211b Update README.md 2018-08-05 11:59:30 +02:00
Oskar 3f6129964e Extend NSControl 2018-08-05 11:56:14 +02:00
Oskar Groth 352f7c8ad2 Update README.md 2018-07-14 19:23:56 +02:00
Oskar Groth 52781c2335 Update README.md 2018-07-14 19:23:47 +02:00
Oskar 6adaab83d6 Title 2018-07-14 19:22:38 +02:00
Oskar 5d549ab629 IBInspectable fixes 2018-07-14 19:19:54 +02:00
Oskar c54689bccc Merge branch 'master' of https://github.com/OskarGroth/OGSwitch 2018-07-14 19:15:14 +02:00
Oskar 5ddc45e132 Remove podspec 2018-07-14 19:15:03 +02:00
Oskar Groth 9bc2acc5f4 Update README.md 2018-07-14 19:13:09 +02:00
Oskar Groth d103720de4 Update 2018-07-14 19:08:46 +02:00
Oskar 09cd2cd79c IBDesignable 2018-07-14 19:06:11 +02:00
Oskar 4c2a062a71 Swift header 2018-07-14 18:54:12 +02:00
Oskar c70ed728d3 Gitignore 2018-07-14 18:24:49 +02:00
Oskar 12a6cb6afe Improve project structure (workspace) 2018-07-14 18:24:00 +02:00
Oskar 0a73d77643 Merge branch 'master' of https://github.com/OskarGroth/OGSwitch 2018-07-10 17:40:33 +02:00
Oskar de2f2f2f29 Add swift header 2018-07-10 17:40:31 +02:00
Oskar Groth 54df55d873 Typo 2018-07-10 17:23:27 +02:00
Oskar Groth 5ea6de9f9c Carthage 2018-07-10 17:22:19 +02:00
22 changed files with 574 additions and 266 deletions
+71
View File
@@ -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
@@ -10,22 +10,10 @@
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 */; };
7553A35220F5045900EEA571 /* OGSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 7553A35020F5045900EEA571 /* OGSwitch.h */; settings = {ATTRIBUTES = (Public, ); }; };
7553A35520F5045900EEA571 /* OGSwitch.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7553A34E20F5045900EEA571 /* OGSwitch.framework */; };
7553A35620F5045900EEA571 /* OGSwitch.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7553A34E20F5045900EEA571 /* OGSwitch.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
7553A35B20F5045F00EEA571 /* 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 PBXContainerItemProxy section */
7553A35320F5045900EEA571 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 750F2E301E5D2CD000C20E79 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 7553A34D20F5045900EEA571;
remoteInfo = OGSwitch;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
7553A35A20F5045900EEA571 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
@@ -33,7 +21,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
7553A35620F5045900EEA571 /* OGSwitch.framework in Embed Frameworks */,
75256FE320FA5AC300ED6782 /* OGSwitch.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@@ -41,15 +29,12 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
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>"; };
7553A34E20F5045900EEA571 /* OGSwitch.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OGSwitch.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7553A35020F5045900EEA571 /* OGSwitch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OGSwitch.h; sourceTree = "<group>"; };
7553A35120F5045900EEA571 /* 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 */
@@ -57,14 +42,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7553A35520F5045900EEA571 /* OGSwitch.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
7553A34B20F5045900EEA571 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
75256FE220FA5ABC00ED6782 /* OGSwitch.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -74,30 +52,20 @@
750F2E2F1E5D2CD000C20E79 = {
isa = PBXGroup;
children = (
750F2E3B1E5D2CD000C20E79 /* OGSwitch */,
750F2E4B1E5D2D7100C20E79 /* OGSwitchDemo */,
7553A34F20F5045900EEA571 /* OGSwitch */,
750F2E3A1E5D2CD000C20E79 /* Products */,
75256FE020FA5ABC00ED6782 /* Frameworks */,
);
sourceTree = "<group>";
};
750F2E3A1E5D2CD000C20E79 /* Products */ = {
isa = PBXGroup;
children = (
750F2E4A1E5D2D7100C20E79 /* OGSwitchDemo.app */,
7553A34E20F5045900EEA571 /* OGSwitch.framework */,
750F2E4A1E5D2D7100C20E79 /* OGSwitch-DemoDemo.app */,
);
name = Products;
sourceTree = "<group>";
};
750F2E3B1E5D2CD000C20E79 /* OGSwitch */ = {
isa = PBXGroup;
children = (
750F2E441E5D2CE100C20E79 /* OGSwitch.swift */,
);
path = OGSwitch;
sourceTree = "<group>";
};
750F2E4B1E5D2D7100C20E79 /* OGSwitchDemo */ = {
isa = PBXGroup;
children = (
@@ -109,32 +77,20 @@
path = OGSwitchDemo;
sourceTree = "<group>";
};
7553A34F20F5045900EEA571 /* OGSwitch */ = {
75256FE020FA5ABC00ED6782 /* Frameworks */ = {
isa = PBXGroup;
children = (
7553A35020F5045900EEA571 /* OGSwitch.h */,
7553A35120F5045900EEA571 /* Info.plist */,
75256FE120FA5ABC00ED6782 /* OGSwitch.framework */,
);
path = OGSwitch;
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
7553A34920F5045900EEA571 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
7553A35220F5045900EEA571 /* OGSwitch.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
750F2E491E5D2D7100C20E79 /* OGSwitchDemo */ = {
750F2E491E5D2D7100C20E79 /* OGSwitch-DemoDemo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 750F2E541E5D2D7200C20E79 /* Build configuration list for PBXNativeTarget "OGSwitchDemo" */;
buildConfigurationList = 750F2E541E5D2D7200C20E79 /* Build configuration list for PBXNativeTarget "OGSwitch-DemoDemo" */;
buildPhases = (
750F2E461E5D2D7100C20E79 /* Sources */,
750F2E471E5D2D7100C20E79 /* Frameworks */,
@@ -144,31 +100,12 @@
buildRules = (
);
dependencies = (
7553A35420F5045900EEA571 /* PBXTargetDependency */,
);
name = OGSwitchDemo;
name = "OGSwitch-DemoDemo";
productName = OGSwitchDemo;
productReference = 750F2E4A1E5D2D7100C20E79 /* OGSwitchDemo.app */;
productReference = 750F2E4A1E5D2D7100C20E79 /* OGSwitch-DemoDemo.app */;
productType = "com.apple.product-type.application";
};
7553A34D20F5045900EEA571 /* OGSwitch */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7553A35920F5045900EEA571 /* Build configuration list for PBXNativeTarget "OGSwitch" */;
buildPhases = (
7553A34920F5045900EEA571 /* Headers */,
7553A34A20F5045900EEA571 /* Sources */,
7553A34B20F5045900EEA571 /* Frameworks */,
7553A34C20F5045900EEA571 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = OGSwitch;
productName = OGSwitch;
productReference = 7553A34E20F5045900EEA571 /* OGSwitch.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -185,14 +122,9 @@
LastSwiftMigration = 0910;
ProvisioningStyle = Automatic;
};
7553A34D20F5045900EEA571 = {
CreatedOnToolsVersion = 10.0;
DevelopmentTeam = ZQK6SX26CE;
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;
@@ -205,8 +137,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
750F2E491E5D2D7100C20E79 /* OGSwitchDemo */,
7553A34D20F5045900EEA571 /* OGSwitch */,
750F2E491E5D2D7100C20E79 /* OGSwitch-DemoDemo */,
);
};
/* End PBXProject section */
@@ -221,13 +152,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
7553A34C20F5045900EEA571 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -239,24 +163,8 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
7553A34A20F5045900EEA571 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7553A35B20F5045F00EEA571 /* OGSwitch.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
7553A35420F5045900EEA571 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 7553A34D20F5045900EEA571 /* OGSwitch */;
targetProxy = 7553A35320F5045900EEA571 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
750F2E501E5D2D7200C20E79 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
@@ -419,71 +327,10 @@
};
name = Release;
};
7553A35720F5045900EEA571 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
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;
GCC_C_LANGUAGE_STANDARD = gnu11;
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.10;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
PRODUCT_BUNDLE_IDENTIFIER = org.cindori.OGSwitch;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
7553A35820F5045900EEA571 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
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;
GCC_C_LANGUAGE_STANDARD = gnu11;
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.10;
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 */
750F2E331E5D2CD000C20E79 /* Build configuration list for PBXProject "OGSwitch" */ = {
750F2E331E5D2CD000C20E79 /* Build configuration list for PBXProject "OGSwitch-Demo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
750F2E3F1E5D2CD000C20E79 /* Debug */,
@@ -492,7 +339,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
750F2E541E5D2D7200C20E79 /* Build configuration list for PBXNativeTarget "OGSwitchDemo" */ = {
750F2E541E5D2D7200C20E79 /* Build configuration list for PBXNativeTarget "OGSwitch-DemoDemo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
750F2E551E5D2D7200C20E79 /* Debug */,
@@ -501,15 +348,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7553A35920F5045900EEA571 /* Build configuration list for PBXNativeTarget "OGSwitch" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7553A35720F5045900EEA571 /* Debug */,
7553A35820F5045900EEA571 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 750F2E301E5D2CD000C20E79 /* Project object */;
@@ -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>
@@ -4,11 +4,6 @@
<dict>
<key>SchemeUserState</key>
<dict>
<key>OGSwitch.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>OGSwitchDemo.xcscheme</key>
<dict>
<key>orderHint</key>
-24
View File
@@ -1,24 +0,0 @@
Pod::Spec.new do |s|
s.name = 'OGSwitch'
s.version = '1.0'
s.summary = 'Switch Control for macOS'
s.homepage = 'https://github.com/OskarGroth/OGSwitch'
s.license = {
:type => 'MIT',
:file => 'LICENSE'
}
s.author = {
'Oskar Groth' => 'oskar@cindori.org'
}
s.source = {
:git => 'https://github.com/OskarGroth/OGSwitch.git',
:tag => s.version.to_s
}
s.platform = :osx, '10.9'
s.source_files = 'OGSwitch/OGSwitch.{swift}'
s.requires_arc = true
s.screenshot = "https://raw.githubusercontent.com/OskarGroth/OGSwitch/master/screenshot.jpg"
s.social_media_url = "https://twitter.com/cindoriapps"
end
+10
View File
@@ -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>
+346
View File
@@ -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 */;
}
@@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7553A34D20F5045900EEA571"
BlueprintIdentifier = "75256FD220FA5A0E00ED6782"
BuildableName = "OGSwitch.framework"
BlueprintName = "OGSwitch"
ReferencedContainer = "container:OGSwitch.xcodeproj">
@@ -45,7 +45,7 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7553A34D20F5045900EEA571"
BlueprintIdentifier = "75256FD220FA5A0E00ED6782"
BuildableName = "OGSwitch.framework"
BlueprintName = "OGSwitch"
ReferencedContainer = "container:OGSwitch.xcodeproj">
@@ -63,7 +63,7 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7553A34D20F5045900EEA571"
BlueprintIdentifier = "75256FD220FA5A0E00ED6782"
BuildableName = "OGSwitch.framework"
BlueprintName = "OGSwitch"
ReferencedContainer = "container:OGSwitch.xcodeproj">
@@ -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>
@@ -2,7 +2,7 @@
// OGSwitch.h
// OGSwitch
//
// Created by Oskar Groth on 2018-07-10.
// Created by Oskar Groth on 2018-07-14.
// Copyright © 2018 Oskar Groth. All rights reserved.
//
@@ -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>
@@ -11,7 +11,26 @@ import QuartzCore
//Can not be NSControl due to 10.9 issues: https://github.com/iluuu1994/ITSwitch/issues/21
public class OGSwitch : NSView {
@IBDesignable public class OGSwitch: NSControl {
public enum Size {
case small
case medium
case large
public var size: CGSize {
switch self {
case .small:
return CGSize(width: 46, height: 28)
case .medium:
return CGSize(width: 56, height: 34)
case .large:
return CGSize(width: 69, height: 41)
}
}
}
@IBInspectable public var tintColor: NSColor = NSColor(calibratedRed:0.27, green: 0.86, blue: 0.36, alpha: 1.0) {
didSet {
@@ -49,16 +68,24 @@ public class OGSwitch : NSView {
reloadLayer()
}
}
@IBInspectable public var ignoreRatio: Bool = false
@IBInspectable public var ignoreRatio: Bool = false {
didSet {
reloadLayer()
}
}
override public var isEnabled: Bool {
didSet {
reloadLayerAnimated(animated: true)
}
}
lazy var kBorderLineWidth: CGFloat = bounds.height*(2/31)
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
var dragEvents = 0
@objc public var action: Selector?
@objc public var target: AnyObject?
public var isOn:Bool = false
public var isActive:Bool = false
public var hasDragged:Bool = false
@@ -69,11 +96,6 @@ public class OGSwitch : NSView {
public var knobInsideLayer: CALayer?
public var iconLayer = CALayer()
public var lockInteraction: Bool = false
public var isEnabled: Bool = true {
didSet {
reloadLayerAnimated(animated: true)
}
}
override public var acceptsFirstResponder: Bool {
get {
@@ -86,11 +108,15 @@ public class OGSwitch : NSView {
setup()
}
override init(frame:NSRect) {
convenience public init(size: CGSize) {
self.init(frame: NSRect(origin: .zero, size: size))
}
override public init(frame:NSRect) {
super.init(frame: frame);
setup()
}
override public func awakeFromNib() {
super.awakeFromNib()
reloadLayerSize()
@@ -149,9 +175,9 @@ public class OGSwitch : NSView {
knobLayer!.autoresizingMask = CAAutoresizingMask.layerHeightSizable
knobLayer!.backgroundColor = knobBackgroundColor.cgColor
knobLayer!.shadowColor = NSColor.black.cgColor
knobLayer!.shadowOffset = CGSize(width:0.0, height:-2.0)
knobLayer!.shadowRadius = 1.0
knobLayer!.shadowOpacity = 0.3
knobLayer!.shadowOffset = CGSize(width:0.0, height:-6.5)
knobLayer!.shadowRadius = 2.5
knobLayer!.shadowOpacity = 0.15
knobLayer?.masksToBounds = false
rootLayer!.addSublayer(knobLayer!)
+1 -1
View File
@@ -24,7 +24,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
@IBAction func switchPress(_ sender: Any) {
NSLog("Switch is now: \(switchButton.isOn)")
NSLog("Switch is now: \((sender as! OGSwitch).isOn)")
// perform(#selector(timer), with: nil, afterDelay: 3)
}
+37 -16
View File
@@ -13,7 +13,7 @@
</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"/>
@@ -22,11 +22,11 @@
<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"/>
@@ -40,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>
@@ -58,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>
@@ -671,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>
@@ -681,7 +681,7 @@
</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"/>
@@ -696,7 +696,7 @@
<userDefinedRuntimeAttributes>
<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"/>
<color key="value" name="systemGreenColor" catalog="System" colorSpace="catalog"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
@@ -704,26 +704,47 @@
</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"/>
<rect key="frame" x="140" y="60" width="46" height="28"/>
<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>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dPq-0j-nKi" customClass="OGSwitch" customModule="OGSwitch">
<rect key="frame" x="272" y="53" width="69" height="41"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<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>
</userDefinedRuntimeAttributes>
<connections>
<action selector="switchPress:" target="Voe-Tx-rLC" id="buu-wq-UpG"/>
</connections>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1VD-pu-2Ej" customClass="OGSwitch" customModule="OGSwitch">
<rect key="frame" x="200" y="57" width="56" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<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>
</userDefinedRuntimeAttributes>
<connections>
<action selector="switchPress:" target="Voe-Tx-rLC" id="wRK-Gm-efR"/>
</connections>
</customView>
</subviews>
</view>
<point key="canvasLocation" x="86" y="-105"/>
<point key="canvasLocation" x="198" y="-127"/>
</window>
</objects>
<resources>
<image name="checkmark" width="35" height="34"/>
</resources>
</document>
+11 -4
View File
@@ -9,10 +9,17 @@ This is a `NSView` subclass that lets you create beautiful iOS-inspired switches
![OGSwitch for macOS](https://s3.amazonaws.com/cindori/images/ogswitch.png "OGSwitch for macOS")
## Installation (CocoaPods)
Configure your Podfile to use `OGSwitch`:
`OGSwitch` now also supports `IBDesignable` and renders directly in Interface Builder:
```pod 'OGSwitch'```
![IBDesignable](https://i.imgur.com/BKUyWGg.png "IBDesignable")
## Installation (Carthage)
Configure your Cartfile to use `OGSwitch`:
```github "OskarGroth/OGSwitch" ~> 2.0```
`OGSwitch` requires Swift 4.2.
## Usage
@@ -30,7 +37,7 @@ Inspired by ITSwitch by Ilija Tovilo.
## License
The MIT License (MIT)
Copyright (c) 2017 Oskar Groth
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