Skip to content

Commit 2a0899f

Browse files
committed
FIX : Not able to use CFAlertViewController in swift file using pod
1 parent 9084ca1 commit 2a0899f

15 files changed

Lines changed: 73 additions & 60 deletions

File tree

CFAlertViewController.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "CFAlertViewController"
19-
s.version = "2.0"
19+
s.version = "2.0.1"
2020
s.summary = "CFAlertViewController is a library that helps you display and customise alerts and action sheets on iPad and iPhone."
2121

2222
# This description is used to generate tags and improve search results.
@@ -79,7 +79,7 @@ Pod::Spec.new do |s|
7979
# Supports git, hg, bzr, svn and HTTP.
8080
#
8181

82-
s.source = { :git => "https://github.com/Codigami/CFAlertViewController.git", :tag => "v2.0" }
82+
s.source = { :git => "https://github.com/Codigami/CFAlertViewController.git", :tag => "v2.0.1" }
8383

8484

8585
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

CFAlertViewController/CFAlertViewController.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import UIKit
1010

1111

1212
@objc(CFAlertViewController)
13-
class CFAlertViewController: UIViewController {
13+
public class CFAlertViewController: UIViewController {
1414

1515
// MARK: - Declarations
1616
public typealias CFAlertViewControllerDismissBlock = (_ isBackgroundTapped: Bool) -> ()
@@ -172,7 +172,7 @@ class CFAlertViewController: UIViewController {
172172
view.addGestureRecognizer(self.tapGesture)
173173
}
174174

175-
override func viewDidLoad() {
175+
override public func viewDidLoad() {
176176
super.viewDidLoad()
177177

178178
// Load Variables
@@ -182,7 +182,7 @@ class CFAlertViewController: UIViewController {
182182
loadDisplayContent()
183183
}
184184

185-
override func viewWillAppear(_ animated: Bool) {
185+
override public func viewWillAppear(_ animated: Bool) {
186186
super.viewWillAppear(animated)
187187

188188
// Update UI
@@ -385,7 +385,7 @@ class CFAlertViewController: UIViewController {
385385

386386

387387
// MARK: - View Rotation / Size Change Method
388-
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
388+
override public func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
389389
super.viewWillTransition(to: size, with: coordinator)
390390
// Code here will execute before the rotation begins.
391391
// Equivalent to placing it in the deprecated method -[willRotateToInterfaceOrientation:duration:]
@@ -402,7 +402,7 @@ class CFAlertViewController: UIViewController {
402402

403403

404404
// MARK: - Key Value Observers
405-
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
405+
override public func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
406406
if (keyPath == "contentSize") {
407407
// Update Container View Frame Without Animation
408408
updateContainerViewFrame(withAnimation: false)
@@ -430,11 +430,11 @@ class CFAlertViewController: UIViewController {
430430
extension CFAlertViewController: UITableViewDataSource, UITableViewDelegate, CFAlertActionTableViewCellDelegate {
431431

432432
// MARK: - UITableViewDataSource
433-
func numberOfSections(in tableView: UITableView) -> Int {
433+
public func numberOfSections(in tableView: UITableView) -> Int {
434434
return 2
435435
}
436436

437-
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
437+
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
438438

439439
switch section {
440440

@@ -456,7 +456,7 @@ extension CFAlertViewController: UITableViewDataSource, UITableViewDelegate, CFA
456456
return 0
457457
}
458458

459-
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
459+
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
460460

461461
var cell: UITableViewCell?
462462

@@ -509,24 +509,24 @@ extension CFAlertViewController: UITableViewDataSource, UITableViewDelegate, CFA
509509
return cell!
510510
}
511511

512-
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
512+
public func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
513513
return UITableViewAutomaticDimension
514514
}
515515

516-
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
516+
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
517517
return UITableViewAutomaticDimension
518518
}
519519

520520

521521
// MARK: UITableViewDelegate
522-
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
522+
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
523523
// Deselect Table Cell
524524
tableView.deselectRow(at: indexPath, animated: true)
525525
}
526526

527527

528528
// MARK: CFAlertActionTableViewCellDelegate
529-
func alertActionCell(_ cell: CFAlertActionTableViewCell, didClickAction action: CFAlertAction?) {
529+
public func alertActionCell(_ cell: CFAlertActionTableViewCell, didClickAction action: CFAlertAction?) {
530530
// Dimiss Self
531531
dismissAlert(withAnimation: true, completion: {() -> Void in
532532
// Call Action Handler If Set
@@ -541,7 +541,7 @@ extension CFAlertViewController: UITableViewDataSource, UITableViewDelegate, CFA
541541
extension CFAlertViewController: UIViewControllerTransitioningDelegate {
542542

543543
// MARK: - Transitioning Delegate
544-
func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
544+
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
545545

546546
if (presented is CFAlertViewController) {
547547
if preferredStyle == .alert {
@@ -558,7 +558,7 @@ extension CFAlertViewController: UIViewControllerTransitioningDelegate {
558558
return nil
559559
}
560560

561-
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
561+
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
562562

563563
if (dismissed is CFAlertViewController) {
564564
if self.preferredStyle == .alert {

CFAlertViewController/Cells/CFAlertActionTableViewCell.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import UIKit
1010

1111

1212
@objc(CFAlertActionTableViewCellDelegate)
13-
protocol CFAlertActionTableViewCellDelegate {
13+
public protocol CFAlertActionTableViewCellDelegate {
1414
func alertActionCell(_ cell: CFAlertActionTableViewCell, didClickAction action: CFAlertAction?);
1515
}
1616

1717

1818
@objc(CFAlertActionTableViewCell)
19-
class CFAlertActionTableViewCell: UITableViewCell {
19+
public class CFAlertActionTableViewCell: UITableViewCell {
2020

2121
// MARK: - Declarations
2222
public static func CF_DEFAULT_ACTION_COLOR() -> UIColor {
@@ -164,7 +164,7 @@ class CFAlertActionTableViewCell: UITableViewCell {
164164

165165

166166
// MARK: - Initialization Methods
167-
override func awakeFromNib() {
167+
override public func awakeFromNib() {
168168
super.awakeFromNib()
169169
basicInitialisation()
170170
}
@@ -175,7 +175,7 @@ class CFAlertActionTableViewCell: UITableViewCell {
175175
basicInitialisation()
176176
}
177177

178-
required init?(coder aDecoder: NSCoder) {
178+
required public init?(coder aDecoder: NSCoder) {
179179
super.init(coder: aDecoder)
180180
}
181181

@@ -187,7 +187,7 @@ class CFAlertActionTableViewCell: UITableViewCell {
187187

188188

189189
// MARK: - Layout Methods
190-
override func layoutSubviews() {
190+
override public func layoutSubviews() {
191191
contentView.setNeedsLayout()
192192
contentView.layoutIfNeeded()
193193
}

CFAlertViewController/Cells/CFAlertActionTableViewCell.xib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
2020
<autoresizingMask key="autoresizingMask"/>
2121
<subviews>
22-
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="750" horizontalCompressionResistancePriority="749" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RuE-Ia-gYW" customClass="CFPushButton" customModule="CFAlertViewControllerDemo">
22+
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="750" horizontalCompressionResistancePriority="749" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RuE-Ia-gYW" customClass="CFPushButton">
2323
<rect key="frame" x="20" y="0.0" width="280" height="50"/>
2424
<color key="backgroundColor" red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2525
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/>

CFAlertViewController/Cells/CFAlertTitleSubtitleTableViewCell.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import UIKit
1010

1111

1212
@objc(CFAlertTitleSubtitleTableViewCell)
13-
class CFAlertTitleSubtitleTableViewCell: UITableViewCell {
13+
public class CFAlertTitleSubtitleTableViewCell: UITableViewCell {
1414

1515
// MARK: - Declarations
1616

@@ -58,7 +58,7 @@ class CFAlertTitleSubtitleTableViewCell: UITableViewCell {
5858

5959

6060
// MARK: Initialization Methods
61-
override func awakeFromNib() {
61+
override public func awakeFromNib() {
6262
super.awakeFromNib()
6363
basicInitialisation()
6464
}
@@ -69,7 +69,7 @@ class CFAlertTitleSubtitleTableViewCell: UITableViewCell {
6969
basicInitialisation()
7070
}
7171

72-
required init?(coder aDecoder: NSCoder) {
72+
required public init?(coder aDecoder: NSCoder) {
7373
super.init(coder: aDecoder)
7474
}
7575

@@ -82,7 +82,7 @@ class CFAlertTitleSubtitleTableViewCell: UITableViewCell {
8282

8383

8484
// MARK: - Layout Methods
85-
override func layoutSubviews() {
85+
override public func layoutSubviews() {
8686
contentView.setNeedsLayout()
8787
contentView.layoutIfNeeded()
8888
}

CFAlertViewController/Cells/CFAlertTitleSubtitleTableViewCell.xib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<rect key="frame" x="0.0" y="0.0" width="320" height="85"/>
1717
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
1818
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="dGl-Zt-7oP" id="7TX-v0-D43">
19-
<rect key="frame" x="0.0" y="0.0" width="320" height="85"/>
19+
<rect key="frame" x="0.0" y="0.0" width="320" height="84.5"/>
2020
<autoresizingMask key="autoresizingMask"/>
2121
<subviews>
2222
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="c2H-hb-4JF">

CFAlertViewController/Models/CFAlertAction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import UIKit
1010

1111

1212
@objc(CFAlertAction)
13-
class CFAlertAction: NSObject, NSCopying {
13+
public class CFAlertAction: NSObject, NSCopying {
1414

1515
// MARK: - Declarations
1616
public typealias CFAlertActionHandlerBlock = (_ action: CFAlertAction) -> ()
@@ -52,7 +52,7 @@ class CFAlertAction: NSObject, NSCopying {
5252

5353

5454
// MARK: - NSCopying
55-
func copy(with zone: NSZone? = nil) -> Any {
55+
public func copy(with zone: NSZone? = nil) -> Any {
5656

5757
let copy : CFAlertAction = CFAlertAction(title: title,
5858
style: style,

CFAlertViewController/Subclass/CFPushButton/CFPushButton.swift

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import UIKit
1010

1111

12-
@objc class CFPushButton: UIButton {
12+
@objc(CFPushButton)
13+
open class CFPushButton: UIButton {
1314

1415
// MARK: - Declarations
1516
public static let CF_PUSH_BUTTON_DEFAULT_TOUCH_DOWN_DURATION: CGFloat = 0.22
@@ -25,39 +26,39 @@ import UIKit
2526
// MARK: - Variables
2627

2728
// Original Transform Property
28-
public var originalTransform = CGAffineTransform.identity {
29+
open var originalTransform = CGAffineTransform.identity {
2930
didSet {
3031
// Update Button Transform
3132
transform = originalTransform
3233
}
3334
}
3435

3536
// Set Highlight Property
36-
public var highlightStateBackgroundColor: UIColor?
37+
open var highlightStateBackgroundColor: UIColor?
3738

3839
// Push Transform Property
39-
public var pushTransformScaleFactor: CGFloat = 0.8
40+
open var pushTransformScaleFactor: CGFloat = 0.8
4041

4142
// Touch Handler Blocks
42-
public var touchDownHandler: ((_ button: CFPushButton) -> Void)?
43-
public var touchUpHandler: ((_ button: CFPushButton) -> Void)?
43+
open var touchDownHandler: ((_ button: CFPushButton) -> Void)?
44+
open var touchUpHandler: ((_ button: CFPushButton) -> Void)?
4445

4546
// Push Transition Animation Properties
46-
public var touchDownDuration: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_DOWN_DURATION
47-
public var touchDownDelay: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_DOWN_DELAY
48-
public var touchDownDamping: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_DOWN_DAMPING
49-
public var touchDownVelocity: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_DOWN_VELOCITY
47+
open var touchDownDuration: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_DOWN_DURATION
48+
open var touchDownDelay: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_DOWN_DELAY
49+
open var touchDownDamping: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_DOWN_DAMPING
50+
open var touchDownVelocity: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_DOWN_VELOCITY
5051

51-
public var touchUpDuration: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_UP_DURATION
52-
public var touchUpDelay: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_UP_DELAY
53-
public var touchUpDamping: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_UP_DAMPING
54-
public var touchUpVelocity: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_UP_VELOCITY
52+
open var touchUpDuration: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_UP_DURATION
53+
open var touchUpDelay: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_UP_DELAY
54+
open var touchUpDamping: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_UP_DAMPING
55+
open var touchUpVelocity: CGFloat = CF_PUSH_BUTTON_DEFAULT_TOUCH_UP_VELOCITY
5556

5657
// Add Extra Parameters
57-
public var extraParam: Any?
58+
open var extraParam: Any?
5859

5960
private var normalStateBackgroundColor: UIColor?
60-
override public var backgroundColor: UIColor? {
61+
override open var backgroundColor: UIColor? {
6162
didSet {
6263
// Store Normal State Background Color
6364
normalStateBackgroundColor = backgroundColor
@@ -66,7 +67,7 @@ import UIKit
6667

6768

6869
// MARK: - Initialization Methods
69-
required init?(coder: NSCoder) {
70+
required public init?(coder: NSCoder) {
7071
super.init(coder: coder)
7172
basicInitialisation()
7273
}
@@ -84,24 +85,24 @@ import UIKit
8485

8586

8687
// MARK: - Touch Events
87-
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
88+
override open func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
8889
super.touchesBegan(touches, with: event)
8990
pushButton(pushButton: true, shouldAnimate: true, completion: nil)
9091
}
9192

92-
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
93+
override open func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
9394
super.touchesEnded(touches, with: event)
9495
pushButton(pushButton: false, shouldAnimate: true, completion: nil)
9596
}
9697

97-
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
98+
override open func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
9899
super.touchesCancelled(touches, with: event)
99100
pushButton(pushButton: false, shouldAnimate: true, completion: nil)
100101
}
101102

102103

103104
// MARK: - Animation Method
104-
func pushButton(pushButton: Bool, shouldAnimate: Bool, completion: (() -> Void)?) {
105+
open func pushButton(pushButton: Bool, shouldAnimate: Bool, completion: (() -> Void)?) {
105106

106107
// Call Touch Events
107108
if pushButton {

CFAlertViewController/Transitions/CFAlertViewControllerActionSheetTransition.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import UIKit
1010

1111

1212
@objc(CFAlertViewControllerActionSheetTransition)
13-
class CFAlertViewControllerActionSheetTransition: NSObject {
13+
public class CFAlertViewControllerActionSheetTransition: NSObject {
1414

1515
// MARK: - Declarations
1616
@objc public enum CFAlertActionSheetTransitionType : Int {
@@ -37,11 +37,11 @@ class CFAlertViewControllerActionSheetTransition: NSObject {
3737
// MARK: - UIViewControllerAnimatedTransitioning
3838
extension CFAlertViewControllerActionSheetTransition: UIViewControllerAnimatedTransitioning {
3939

40-
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
40+
public func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
4141
return 0.4
4242
}
4343

44-
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
44+
public func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
4545

4646
// Get context vars
4747
let duration: TimeInterval = self.transitionDuration(using: transitionContext)

CFAlertViewController/Transitions/CFAlertViewControllerPopupTransition.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import UIKit
1010

1111

1212
@objc(CFAlertViewControllerPopupTransition)
13-
class CFAlertViewControllerPopupTransition: NSObject {
13+
public class CFAlertViewControllerPopupTransition: NSObject {
1414

1515
// MARK: - Declarations
1616
@objc public enum CFAlertPopupTransitionType : Int {
@@ -37,11 +37,11 @@ class CFAlertViewControllerPopupTransition: NSObject {
3737
// MARK: - UIViewControllerAnimatedTransitioning
3838
extension CFAlertViewControllerPopupTransition: UIViewControllerAnimatedTransitioning {
3939

40-
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
40+
public func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
4141
return 0.4
4242
}
4343

44-
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
44+
public func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
4545

4646
// Get context vars
4747
let duration: TimeInterval = self.transitionDuration(using: transitionContext)

0 commit comments

Comments
 (0)