Skip to content

Commit

Permalink
Upgrade framework and example to Swift 4.2 (alexisakers#110)
Browse files Browse the repository at this point in the history
* Upgrade framework and example to Swift 4.2

* Update build-related files, readme, changelog

* Add Swift version in Podspec

* Remove Developer ID
  • Loading branch information
a2 authored and alexisakers committed Nov 3, 2018
1 parent ab2e650 commit 7086607
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 86 deletions.
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
osx_image: xcode9
osx_image: xcode10
language: objective-c

env:
Expand All @@ -19,12 +19,10 @@ before_script:
script:
- xcodebuild -workspace "$WORKSPACE" -list
# Build Framework
- set -o pipefail && xcodebuild clean build -workspace "$WORKSPACE" -scheme "BLTNBoard" -destination "$DESTINATION" SWIFT_VERSION="3.0" | xcpretty
- set -o pipefail && xcodebuild clean build -workspace "$WORKSPACE" -scheme "BLTNBoard" -destination "$DESTINATION" SWIFT_VERSION="4.0" | xcpretty
- set -o pipefail && xcodebuild clean build -workspace "$WORKSPACE" -scheme "BLTNBoard" -destination "$DESTINATION" | xcpretty
# Build Demo Project
- set -o pipefail && xcodebuild clean build -workspace "$WORKSPACE" -scheme "BB-Swift" -destination "$DESTINATION" | xcpretty
- set -o pipefail && xcodebuild clean build -workspace "$WORKSPACE" -scheme "BB-ObjC" -destination "$DESTINATION" | xcpretty
# Build Project with Package Managers
- carthage build --platform $PLATFORM --no-skip-current
- pod lib lint --swift-version=3.0
- pod lib lint --swift-version=4.0
- pod lib lint
8 changes: 5 additions & 3 deletions BLTNBoard.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
TargetAttributes = {
52D6D97B1BEFF229002C0205 = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0920;
LastSwiftMigration = 1000;
};
};
};
Expand Down Expand Up @@ -626,7 +626,8 @@
PRODUCT_NAME = BLTNBoard;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -648,7 +649,8 @@
PRODUCT_NAME = BLTNBoard;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
4 changes: 2 additions & 2 deletions BulletinBoard.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "BulletinBoard"
s.version = "2.0.2"
s.version = "3.0.0"
s.summary = "Generate and Display Bottom Card Interfaces for iOS"
s.description = <<-DESC
BulletinBoard is an iOS library that generates and manages contextual cards displayed at the bottom of the screen. It is especially well suited for quick user interactions such as onboarding screens or configuration.
Expand All @@ -19,5 +19,5 @@ Pod::Spec.new do |s|
s.documentation_url = "https://alexaubry.github.io/BulletinBoard"
s.module_name = "BLTNBoard"
s.resources = "Resources/**/*.{lproj,png}"
s.swift_version = "3.0"
s.swift_version = "4.2"
end
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# _BulletinBoard_ Changelog

## 🔖 v3.0.0

- Upgrade to Swift 4.2

## 🔖 v2.0.2

- Fix setters and retain semantics
Expand Down
13 changes: 7 additions & 6 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@
TargetAttributes = {
558A12401F7D7865005EC97C = {
CreatedOnToolsVersion = 9.1;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
};
559F8E9A204DBFE300322949 = {
Expand Down Expand Up @@ -622,13 +623,13 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 75E8K39Z38;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "$(SRCROOT)/Configs/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.BulletinBoard.BB-Swift";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -638,13 +639,13 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 75E8K39Z38;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "$(SRCROOT)/Configs/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.BulletinBoard.BB-Swift";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down Expand Up @@ -674,7 +675,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 75E8K39Z38;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "$(SRCROOT)/Configs/Info-ObjC.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -695,7 +696,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 75E8K39Z38;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "$(SRCROOT)/Configs/Info-ObjC.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Example/Swift/Bulletin/BackgroundStyles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func BackgroundStyles() -> [(name: String, style: BLTNBackgroundViewStyle)] {
styles.append(("Extra Light", .blurredExtraLight))
styles.append(("Light", .blurredLight))
styles.append(("Dark", .blurredDark))
styles.append(("Extra Dark", .blurred(style: UIBlurEffectStyle(rawValue: 3)!, isDark: true)))
styles.append(("Extra Dark", .blurred(style: UIBlurEffect.Style(rawValue: 3)!, isDark: true)))
}

return styles
Expand Down
12 changes: 6 additions & 6 deletions Example/Swift/Bulletin/PetSelectorBulletinPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ class PetSelectorBulletinPage: FeedbackPageBLTNItem {
button.accessibilityLabel = animalType

if isSelected {
button.accessibilityTraits |= UIAccessibilityTraitSelected
button.accessibilityTraits.insert(.selected)
} else {
button.accessibilityTraits &= ~UIAccessibilityTraitSelected
button.accessibilityTraits.remove(.selected)
}

button.layer.cornerRadius = 12
Expand Down Expand Up @@ -138,12 +138,12 @@ class PetSelectorBulletinPage: FeedbackPageBLTNItem {
let catButtonColor = appearance.actionButtonColor
catButtonContainer?.layer.borderColor = catButtonColor.cgColor
catButtonContainer?.setTitleColor(catButtonColor, for: .normal)
catButtonContainer?.accessibilityTraits |= UIAccessibilityTraitSelected
catButtonContainer?.accessibilityTraits.insert(.selected)

let dogButtonColor = UIColor.lightGray
dogButtonContainer?.layer.borderColor = dogButtonColor.cgColor
dogButtonContainer?.setTitleColor(dogButtonColor, for: .normal)
dogButtonContainer?.accessibilityTraits &= ~UIAccessibilityTraitSelected
dogButtonContainer?.accessibilityTraits.remove(.selected)

// Send a notification to inform observers of the change

Expand All @@ -170,12 +170,12 @@ class PetSelectorBulletinPage: FeedbackPageBLTNItem {
let catButtonColor = UIColor.lightGray
catButtonContainer?.layer.borderColor = catButtonColor.cgColor
catButtonContainer?.setTitleColor(catButtonColor, for: .normal)
catButtonContainer?.accessibilityTraits &= ~UIAccessibilityTraitSelected
catButtonContainer?.accessibilityTraits.remove(.selected)

let dogButtonColor = appearance.actionButtonColor
dogButtonContainer?.layer.borderColor = dogButtonColor.cgColor
dogButtonContainer?.setTitleColor(dogButtonColor, for: .normal)
dogButtonContainer?.accessibilityTraits |= UIAccessibilityTraitSelected
dogButtonContainer?.accessibilityTraits.insert(.selected)

// Send a notification to inform observers of the change

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Here are some screenshots showing what you can build with BulletinBoard:

## Requirements

- Xcode 9 and later
- Xcode 10 and later
- iOS 9 and later
- Swift 3.2 and later
- Swift 4.2 and later

## Demo

Expand Down
4 changes: 2 additions & 2 deletions Sources/Appearance/BLTNBackgroundViewStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import UIKit

case none
case dimmed
case blurred(style: UIBlurEffectStyle, isDark: Bool)
case blurred(style: UIBlurEffect.Style, isDark: Bool)

var isDark: Bool {

Expand Down Expand Up @@ -68,7 +68,7 @@ extension BLTNBackgroundViewStyle {
*/

@available(iOS 10, *)
@objc public static func blurred(style: UIBlurEffectStyle, isDark: Bool) -> BLTNBackgroundViewStyle {
@objc public static func blurred(style: UIBlurEffect.Style, isDark: Bool) -> BLTNBackgroundViewStyle {
return BLTNBackgroundViewStyle(rawValue: .blurred(style: style, isDark: isDark))
}

Expand Down
10 changes: 5 additions & 5 deletions Sources/Appearance/BLTNInterfaceBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import UIKit
let titleLabel = UILabel()
titleLabel.textAlignment = .center
titleLabel.textColor = appearance.titleTextColor
titleLabel.accessibilityTraits |= UIAccessibilityTraitHeader
titleLabel.accessibilityTraits.insert(.header)
titleLabel.numberOfLines = 2
titleLabel.adjustsFontSizeToFitWidth = true
titleLabel.lineBreakMode = .byWordWrapping
Expand Down Expand Up @@ -114,10 +114,10 @@ import UIKit
}

let wrapper = BLTNHighlightButtonWrapper(button: actionButton)
wrapper.setContentHuggingPriority(UILayoutPriorityDefaultLow, for: .horizontal)
wrapper.setContentHuggingPriority(.defaultLow, for: .horizontal)

let heightConstraint = wrapper.heightAnchor.constraint(equalToConstant: 55)
heightConstraint.priority = UILayoutPriorityDefaultHigh
heightConstraint.priority = .defaultHigh
heightConstraint.isActive = true

return wrapper
Expand Down Expand Up @@ -187,8 +187,8 @@ import UIKit

let container = BLTNContainerView()

container.contentSize = CGSize(width: width.flatMap(CGFloat.init) ?? UIViewNoIntrinsicMetric,
height: height.flatMap(CGFloat.init) ?? UIViewNoIntrinsicMetric)
container.contentSize = CGSize(width: width.flatMap(CGFloat.init) ?? UIView.noIntrinsicMetric,
height: height.flatMap(CGFloat.init) ?? UIView.noIntrinsicMetric)

container.setChildView(view) { parent, child in

Expand Down
13 changes: 3 additions & 10 deletions Sources/Appearance/BLTNItemAppearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ extension BLTNItemAppearance {
if let titleFontDescriptor = self.titleFontDescriptor {
return UIFont(descriptor: titleFontDescriptor, size: titleFontSize)
} else {
return UIFont.systemFont(ofSize: titleFontSize, weight: UIFontWeightMedium)
return UIFont.systemFont(ofSize: titleFontSize, weight: .medium)
}

}
Expand Down Expand Up @@ -133,7 +133,7 @@ extension BLTNItemAppearance {
if let buttonFontDescriptor = self.buttonFontDescriptor {
return UIFont(descriptor: buttonFontDescriptor, size: actionButtonFontSize)
} else {
return UIFont.systemFont(ofSize: actionButtonFontSize, weight: UIFontWeightSemibold)
return UIFont.systemFont(ofSize: actionButtonFontSize, weight: .semibold)
}

}
Expand All @@ -147,7 +147,7 @@ extension BLTNItemAppearance {
if let buttonFontDescriptor = self.buttonFontDescriptor {
return UIFont(descriptor: buttonFontDescriptor, size: alternativeButtonFontSize)
} else {
return UIFont.systemFont(ofSize: alternativeButtonFontSize, weight: UIFontWeightSemibold)
return UIFont.systemFont(ofSize: alternativeButtonFontSize, weight: .semibold)
}

}
Expand Down Expand Up @@ -175,10 +175,3 @@ extension BLTNItemAppearance {
case darkContent

}

// MARK: - Swift Compatibility

#if swift(>=4.0)
let UIFontWeightMedium = UIFont.Weight.medium
let UIFontWeightSemibold = UIFont.Weight.semibold
#endif
2 changes: 1 addition & 1 deletion Sources/BLTNItemManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ extension BLTNItemManager {

}

UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, newArrangedSubviews.first)
UIAccessibility.post(notification: .screenChanged, argument: newArrangedSubviews.first)

}

Expand Down
6 changes: 3 additions & 3 deletions Sources/Support/Animations/AnimationChain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class AnimationChain {
let animation = animations.removeFirst()

let duration = animation.relativeDuration * self.duration
let options = UIViewAnimationOptions(rawValue: UInt(animation.curve.rawValue << 16))
let options = UIView.AnimationOptions(rawValue: UInt(animation.curve.rawValue << 16))
let delay: TimeInterval = didFinishFirstAnimation ? 0 : initialDelay

UIView.animate(withDuration: duration, delay: delay, options: options, animations: animation.block) { _ in
Expand Down Expand Up @@ -125,7 +125,7 @@ public class AnimationPhase {
* The animation curve.
*/

public let curve: UIViewAnimationCurve
public let curve: UIView.AnimationCurve

/**
* The animation code.
Expand All @@ -149,7 +149,7 @@ public class AnimationPhase {
* - parameter curve: The animation curve
*/

public init(relativeDuration: TimeInterval, curve: UIViewAnimationCurve) {
public init(relativeDuration: TimeInterval, curve: UIView.AnimationCurve) {

self.relativeDuration = relativeDuration
self.curve = curve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class BulletinDismissAnimationController: NSObject, UIViewControllerAnimatedTran
snapshotActivityIndicator.rightAnchor.constraint(equalTo: snapshot.rightAnchor).isActive = true
snapshotActivityIndicator.bottomAnchor.constraint(equalTo: snapshot.bottomAnchor).isActive = true

snapshotActivityIndicator.activityIndicatorViewStyle = .whiteLarge
snapshotActivityIndicator.style = .whiteLarge
snapshotActivityIndicator.color = .black
snapshotActivityIndicator.isUserInteractionEnabled = false

Expand All @@ -58,7 +58,7 @@ class BulletinDismissAnimationController: NSObject, UIViewControllerAnimatedTran
// Animate dismissal

let duration = transitionDuration(using: transitionContext)
let options = UIViewAnimationOptions(rawValue: 6 << 16)
let options = UIView.AnimationOptions(rawValue: 6 << 16)

let animations = {
snapshot.frame.origin.y = rootView.frame.maxY + 12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class BulletinPresentationAnimationController: NSObject, UIViewControllerAnimate
// Animate presentation

let duration = transitionDuration(using: transitionContext)
let options = UIViewAnimationOptions(rawValue: 7 << 16)
let options = UIView.AnimationOptions(rawValue: 7 << 16)

let animations = {
toVC.moveIntoPlace()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class BulletinSwipeInteractionController: UIPercentDrivenInteractiveTransition,

private func resetCardViews() {

let options: UIViewAnimationOptions = UIViewAnimationOptions(rawValue: 6 << 7)
let options = UIView.AnimationOptions(rawValue: 6 << 7)

let animations = {
self.snapshotView?.transform = .identity
Expand Down
Loading

0 comments on commit 7086607

Please sign in to comment.