From d05b6c6d4eb9c44c94c4ac7f83a63c31adda257a Mon Sep 17 00:00:00 2001 From: maxep Date: Tue, 6 Aug 2019 15:51:25 +0200 Subject: [PATCH] Objective-C Bridging --- Example/CustomViewController.swift | 10 +++++----- Example/TopBarViewController.swift | 6 +++--- MXSegmentedControl/MXIndicator.swift | 1 + MXSegmentedControl/MXSegment.swift | 5 +++-- MXSegmentedControl/MXSegmentedControl.swift | 5 +++-- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Example/CustomViewController.swift b/Example/CustomViewController.swift index d7bee12..5937553 100644 --- a/Example/CustomViewController.swift +++ b/Example/CustomViewController.swift @@ -48,15 +48,15 @@ class CustomViewController: UIViewController { segmentedControl2.append(title: "Second") segmentedControl3.append(title: "First") - .set(title: #colorLiteral(red: 0.9981629252, green: 0.6096215844, blue: 0.6670924425, alpha: 1), for: .selected) + .set(titleColor: #colorLiteral(red: 0.9981629252, green: 0.6096215844, blue: 0.6670924425, alpha: 1), for: .selected) segmentedControl3.append(title: "Second") - .set(title: #colorLiteral(red: 1, green: 0.7996580601, blue: 0.4006214142, alpha: 1), for: .selected) + .set(titleColor: #colorLiteral(red: 1, green: 0.7996580601, blue: 0.4006214142, alpha: 1), for: .selected) segmentedControl3.append(title: "Third") - .set(title: #colorLiteral(red: 0.9995033145, green: 0.9875727296, blue: 0.4039593935, alpha: 1), for: .selected) + .set(titleColor: #colorLiteral(red: 0.9995033145, green: 0.9875727296, blue: 0.4039593935, alpha: 1), for: .selected) segmentedControl3.append(title: "Fourth") - .set(title: #colorLiteral(red: 0.8013994098, green: 0.9842005372, blue: 0.4007700682, alpha: 1), for: .selected) + .set(titleColor: #colorLiteral(red: 0.8013994098, green: 0.9842005372, blue: 0.4007700682, alpha: 1), for: .selected) segmentedControl3.append(title: "Fifth") - .set(title: #colorLiteral(red: 0.4016934037, green: 0.9801344275, blue: 0.3977853954, alpha: 1), for: .selected) + .set(titleColor: #colorLiteral(red: 0.4016934037, green: 0.9801344275, blue: 0.3977853954, alpha: 1), for: .selected) segmentedControl3.indicator.boxView.alpha = 0.1 diff --git a/Example/TopBarViewController.swift b/Example/TopBarViewController.swift index 557c66d..57d8520 100644 --- a/Example/TopBarViewController.swift +++ b/Example/TopBarViewController.swift @@ -31,11 +31,11 @@ class TopBarViewController: UIViewController { super.viewDidLoad() segmentedControl.append(title: "Segmentio") - .set(title: #colorLiteral(red: 0.08598647267, green: 0.093843095, blue: 0.1104642078, alpha: 1), for: .selected) + .set(titleColor: #colorLiteral(red: 0.08598647267, green: 0.093843095, blue: 0.1104642078, alpha: 1), for: .selected) segmentedControl.append(title: "HMSegmentedControl") - .set(title: #colorLiteral(red: 0.08598647267, green: 0.093843095, blue: 0.1104642078, alpha: 1), for: .selected) + .set(titleColor: #colorLiteral(red: 0.08598647267, green: 0.093843095, blue: 0.1104642078, alpha: 1), for: .selected) segmentedControl.append(title: "Other") - .set(title: #colorLiteral(red: 0.9098039269, green: 0.4784313738, blue: 0.6431372762, alpha: 1), for: .selected) + .set(titleColor: #colorLiteral(red: 0.9098039269, green: 0.4784313738, blue: 0.6431372762, alpha: 1), for: .selected) segmentedControl.indicator.lineView.backgroundColor = #colorLiteral(red: 0.9568627451, green: 0.4392156863, blue: 0.3803921569, alpha: 1) segmentedControl.addTarget(self, action: #selector(changeIndex(segmentedControl:)), for: .valueChanged) diff --git a/MXSegmentedControl/MXIndicator.swift b/MXSegmentedControl/MXIndicator.swift index 14c6b3c..f59ff93 100644 --- a/MXSegmentedControl/MXIndicator.swift +++ b/MXSegmentedControl/MXIndicator.swift @@ -22,6 +22,7 @@ import UIKit +@objcMembers public class MXIndicator: UIView { /// The indicator line position diff --git a/MXSegmentedControl/MXSegment.swift b/MXSegmentedControl/MXSegment.swift index 30b93a4..e3e853c 100644 --- a/MXSegmentedControl/MXSegment.swift +++ b/MXSegmentedControl/MXSegment.swift @@ -23,6 +23,7 @@ import UIKit /// A segment button embed in MXSegmentedControl +@objcMembers public class MXSegment: UIButton { /// The Image position in segment related to title. @@ -75,8 +76,8 @@ public class MXSegment: UIButton { return self } - @discardableResult public func set(title color: UIColor?, for state: UIControl.State = .normal) -> MXSegment { - super.setTitleColor(color, for: state) + @discardableResult public func set(titleColor: UIColor?, for state: UIControl.State = .normal) -> MXSegment { + super.setTitleColor(titleColor, for: state) return self } diff --git a/MXSegmentedControl/MXSegmentedControl.swift b/MXSegmentedControl/MXSegmentedControl.swift index c1375e5..98cc057 100644 --- a/MXSegmentedControl/MXSegmentedControl.swift +++ b/MXSegmentedControl/MXSegmentedControl.swift @@ -31,7 +31,9 @@ import UIKit /// You register the target-action methods for a segmented control using the value​Changed constant as shown below. /// /// segmentedControl.addTarget(self, action: "action:", forControlEvents: .ValueChanged) -@IBDesignable open class MXSegmentedControl: UIControl { +@IBDesignable +@objcMembers +open class MXSegmentedControl: UIControl { // MARK: Customizing Appearance @@ -289,7 +291,6 @@ import UIKit } // MARK: - Interface Builder Inspectable and Appearence - extension MXSegmentedControl { @IBInspectable public dynamic var cornerRadius: CGFloat {