diff --git a/.gitignore b/.gitignore
index 85900db..9de3921 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
xcuserdata
*.xccheckout
-*.xcuserstate
\ No newline at end of file
+*.xcuserstate
+Build/
\ No newline at end of file
diff --git a/DGRunkeeperSwitch.podspec b/DGRunkeeperSwitch.podspec
index df2822e..fcbd992 100644
--- a/DGRunkeeperSwitch.podspec
+++ b/DGRunkeeperSwitch.podspec
@@ -1,18 +1,18 @@
Pod::Spec.new do |s|
s.name = "DGRunkeeperSwitch"
- s.version = "1.1.1"
- s.authors = { "Danil Gontovnik" => "gontovnik.danil@gmail.com" }
+ s.version = "1.1.3"
+ s.authors = { "Danil Gontovnik" => "danil@gontovnik.com" }
s.homepage = "https://github.com/gontovnik/DGRunkeeperSwitch"
s.summary = "DGRunkeeperSwitch is Runkeeper design switch control (two part segment control)."
s.source = { :git => "https://github.com/gontovnik/DGRunkeeperSwitch.git",
- :tag => '1.1.1' }
+ :tag => '1.1.3' }
s.license = { :type => "MIT", :file => "LICENSE" }
s.platform = :ios, '8.0'
s.source_files = "DGRunkeeperSwitch/**/*.swift"
s.requires_arc = true
-
+
s.ios.deployment_target = '8.0'
s.ios.frameworks = ['UIKit', 'Foundation']
end
diff --git a/DGRunkeeperSwitch/DGRunkeeperSwitch.swift b/DGRunkeeperSwitch/DGRunkeeperSwitch.swift
index a584bf3..9f04c47 100644
--- a/DGRunkeeperSwitch/DGRunkeeperSwitch.swift
+++ b/DGRunkeeperSwitch/DGRunkeeperSwitch.swift
@@ -56,7 +56,6 @@ public class DGRunkeeperSwitch: UIControl {
get { return titleLabels.map { $0.text! } }
}
- @IBInspectable
private(set) public var selectedIndex: Int = 0
public var selectedBackgroundInset: CGFloat = 2.0 {
@@ -83,6 +82,12 @@ public class DGRunkeeperSwitch: UIControl {
didSet { (titleLabels + selectedTitleLabels).forEach { $0.font = titleFont } }
}
+ @IBInspectable
+ public var titleFontFamily: String = "HelveticaNeue"
+
+ @IBInspectable
+ public var titleFontSize: CGFloat = 18.0
+
public var animationDuration: NSTimeInterval = 0.3
public var animationSpringDamping: CGFloat = 0.75
public var animationInitialSpringVelocity: CGFloat = 0.0
@@ -142,23 +147,32 @@ public class DGRunkeeperSwitch: UIControl {
titleMaskView.backgroundColor = .blackColor()
selectedTitleLabelsContentView.layer.mask = titleMaskView.layer
- // Setup default colors
- backgroundColor = .blackColor()
+ // Setup defaul colors
+ if backgroundColor == nil {
+ backgroundColor = .blackColor()
+ }
+
selectedBackgroundColor = .whiteColor()
titleColor = .whiteColor()
selectedTitleColor = .blackColor()
// Gestures
- tapGesture = UITapGestureRecognizer(target: self, action: "tapped:")
+ tapGesture = UITapGestureRecognizer(target: self, action: #selector(tapped))
addGestureRecognizer(tapGesture)
- panGesture = UIPanGestureRecognizer(target: self, action: "pan:")
+ panGesture = UIPanGestureRecognizer(target: self, action: #selector(pan))
panGesture.delegate = self
addGestureRecognizer(panGesture)
addObserver(self, forKeyPath: "selectedBackgroundView.frame", options: .New, context: nil)
}
+ override public func awakeFromNib() {
+ super.awakeFromNib()
+
+ self.titleFont = UIFont(name: self.titleFontFamily, size: self.titleFontSize)
+ }
+
// MARK: -
// MARK: Destructor
diff --git a/DGRunkeeperSwitch/Info.plist b/DGRunkeeperSwitch/Info.plist
index 3034b22..8625840 100644
--- a/DGRunkeeperSwitch/Info.plist
+++ b/DGRunkeeperSwitch/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 1.1.2
+ 1.1.4
CFBundleSignature
????
CFBundleVersion
diff --git a/DGRunkeeperSwitchExample/Base.lproj/LaunchScreen.storyboard b/DGRunkeeperSwitchExample/Base.lproj/LaunchScreen.storyboard
index 565aa5b..f6e2022 100644
--- a/DGRunkeeperSwitchExample/Base.lproj/LaunchScreen.storyboard
+++ b/DGRunkeeperSwitchExample/Base.lproj/LaunchScreen.storyboard
@@ -1,8 +1,8 @@
-
+
-
+
@@ -16,7 +16,6 @@
-
diff --git a/DGRunkeeperSwitchExample/Base.lproj/Main.storyboard b/DGRunkeeperSwitchExample/Base.lproj/Main.storyboard
index 80d6878..4dc6439 100644
--- a/DGRunkeeperSwitchExample/Base.lproj/Main.storyboard
+++ b/DGRunkeeperSwitchExample/Base.lproj/Main.storyboard
@@ -1,8 +1,8 @@
-
+
-
+
@@ -35,10 +35,16 @@
-
+
+
+
+
+
+
+
diff --git a/DGRunkeeperSwitchExample/ViewController.swift b/DGRunkeeperSwitchExample/ViewController.swift
index b3240d0..37902c8 100644
--- a/DGRunkeeperSwitchExample/ViewController.swift
+++ b/DGRunkeeperSwitchExample/ViewController.swift
@@ -33,7 +33,7 @@ class ViewController: UIViewController {
runkeeperSwitch.selectedTitleColor = UIColor(red: 255.0/255.0, green: 196.0/255.0, blue: 92.0/255.0, alpha: 1.0)
runkeeperSwitch.titleFont = UIFont(name: "HelveticaNeue-Medium", size: 13.0)
runkeeperSwitch.frame = CGRect(x: 30.0, y: 40.0, width: 200.0, height: 30.0)
- runkeeperSwitch.addTarget(self, action: Selector("switchValueDidChange:"), forControlEvents: .ValueChanged)
+ runkeeperSwitch.addTarget(self, action: #selector(ViewController.switchValueDidChange(_:)), forControlEvents: .ValueChanged)
navigationItem.titleView = runkeeperSwitch
let runkeeperSwitch2 = DGRunkeeperSwitch()