Skip to content

Commit

Permalink
Support Swift 5
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbGarciam committed Mar 31, 2019
1 parent 44c75be commit a5b7042
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 20 deletions.
4 changes: 2 additions & 2 deletions AnimatedTabBar.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'AnimatedTabBar'
s.version = '0.1.5'
s.version = '0.1.6'
s.summary = 'Animated tabbar is Swift UI module framework for adding animations to iOS tabBar items and icons.'

# This description is used to generate tags and improve search results.
Expand All @@ -30,7 +30,7 @@ Pod::Spec.new do |s|

s.platform = :ios
s.ios.deployment_target = '10.0'
s.swift_version = '4.2'
s.swift_version = '5'

s.source_files = 'AnimatedTabBar/Classes/**/*'

Expand Down
8 changes: 6 additions & 2 deletions AnimatedTabBar/Classes/AnimatedTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ open class AnimatedTabBarController: UIViewController {
override open func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

heightConstraint = NSLayoutConstraint(item: tabBar,
heightConstraint = NSLayoutConstraint(item: tabBar!,
attribute: .height,
relatedBy: .equal,
toItem: nil,
Expand All @@ -54,7 +54,7 @@ open class AnimatedTabBarController: UIViewController {
if let heightConstraint = heightConstraint {
heightConstraint.constant = heightOfStackView+bottomSafeAreaHeight
} else {
let heightConstraint = NSLayoutConstraint(item: tabBar,
let heightConstraint = NSLayoutConstraint(item: tabBar!,
attribute: .height,
relatedBy: .equal,
toItem: nil,
Expand Down Expand Up @@ -97,13 +97,17 @@ open class AnimatedTabBarController: UIViewController {
extension AnimatedTabBarController : AnimatedTabBarInternalDelegate {
func selected(_ tabbar: AnimatedTabBar, newItem: UIViewController?, oldItem: UIViewController?) {
if let oldController = oldItem {
oldController.willMove(toParent: nil)
oldController.removeFromParent()
oldController.view.removeFromSuperview()
oldController.didMove(toParent: nil)
}
if let newController = newItem {
newController.willMove(toParent: self)
addChild(newController)
contentView.addSubview(newController.view)
newController.view.frame = contentView.bounds
newController.didMove(toParent: self)
}
}
}
2 changes: 1 addition & 1 deletion AnimatedTabBar/Classes/AnimatedTabBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class AnimatedTabBarView: CommonUIView {
}

private func generateTopConstraint() {
topConstraint = NSLayoutConstraint(item: imageView,
topConstraint = NSLayoutConstraint(item: imageView!,
attribute: .top,
relatedBy: .equal,
toItem: contentView,
Expand Down
4 changes: 2 additions & 2 deletions AnimatedTabBar/Classes/LabelAndDot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class LabelAndDot: CommonUIView {
dot.translatesAutoresizingMaskIntoConstraints = false
addSubview(dot)

widthConstraint = NSLayoutConstraint(item: dot, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 4)
heightConstraint = NSLayoutConstraint(item: dot, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 4)
widthConstraint = NSLayoutConstraint(item: dot!, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 4)
heightConstraint = NSLayoutConstraint(item: dot!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 4)
addConstraints([widthConstraint, heightConstraint])
dot.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
dot.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0).isActive = true
Expand Down
5 changes: 2 additions & 3 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
68A825C7F8D8A6B9CAB1BE48 /* Pods-Example.debug.xcconfig */,
3E5A3AAE0FF4A4AA4235459C /* Pods-Example.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -294,6 +293,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -348,6 +348,7 @@
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -365,7 +366,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.mobile.example.animatedtabbar.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -383,7 +383,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.mobile.example.animatedtabbar.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
AnimatedTabBar: 3b2906e1b00bbcc0a802bf6fc6952da40111562f
AnimatedTabBar: 969204cc23401df27f5bf139ee427f2c1d19e045

PODFILE CHECKSUM: fc65f9f27ba568edebbc876e6a99afcc1265bc10

Expand Down
2 changes: 1 addition & 1 deletion Example/Pods/Local Podspecs/AnimatedTabBar.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To run the example project, clone the repo, and run `pod install` from the Examp

## Requirements
* iOS 10.0+
* Swift 4.2
* Swift 5

## Installation

Expand Down

0 comments on commit a5b7042

Please sign in to comment.