2 Commits

Author SHA1 Message Date
Oskar Groth 32f6a6d397 Pod 2017-04-10 09:57:24 +02:00
Oskar Groth 0523e2578c SetOn 2017-04-10 09:56:21 +02:00
4 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = 'OGSwitch'
s.version = '1.5'
s.version = '1.7'
s.summary = 'Switch with icon'
s.homepage = 'https://github.com/OskarGroth/OGSwitch'
s.license = {
@@ -15,7 +15,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "77"
endingLineNumber = "77"
landmarkName = "setupIcon()"
landmarkName = "init(coder:)"
landmarkType = "7">
<Locations>
<Location
+7
View File
@@ -93,6 +93,13 @@ public class OGSwitch : NSControl {
setupIcon()
}
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
+1
View File
@@ -30,6 +30,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@objc func timer() {
print("Trim is after now: \(switchButton.isOn)")
switchButton.setOn(isOn: !switchButton.isOn, animated: false)
}
}