Skip to content

Commit

Permalink
Merge pull request #48 from thefuntasty/feature/swift-4.2
Browse files Browse the repository at this point in the history
Feature: Swift 4.2
  • Loading branch information
mkj-is authored Aug 27, 2018
2 parents 250f187 + ad12453 commit 08fb13c
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Configs/FuntastyKit.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion FuntastyKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "FuntastyKit"
s.version = "1.1.2"
s.version = "1.2.0"
s.summary = "A collection of Swift utilities and protocols used in our projects."
s.description = <<-DESC
A collection of Swift utilities and protocols used in our projects.
Expand Down
23 changes: 10 additions & 13 deletions FuntastyKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -825,12 +825,10 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.FuntastyKit.FuntastyKit-iOS";
PRODUCT_BUNDLE_IDENTIFIER = com.funtasty.funtastykit.ios;
PRODUCT_NAME = FuntastyKit;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -848,11 +846,10 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.FuntastyKit.FuntastyKit-iOS";
PRODUCT_BUNDLE_IDENTIFIER = com.funtasty.funtastykit.ios;
PRODUCT_NAME = FuntastyKit;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down Expand Up @@ -894,7 +891,7 @@
INFOPLIST_FILE = Configs/FuntastyKit.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.FuntastyKit.FuntastyKit-watchOS";
PRODUCT_BUNDLE_IDENTIFIER = com.funtasty.funtastykit.watchos;
PRODUCT_NAME = FuntastyKit;
SDKROOT = watchos;
SKIP_INSTALL = YES;
Expand All @@ -916,7 +913,7 @@
INFOPLIST_FILE = Configs/FuntastyKit.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.FuntastyKit.FuntastyKit-watchOS";
PRODUCT_BUNDLE_IDENTIFIER = com.funtasty.funtastykit.watchos;
PRODUCT_NAME = FuntastyKit;
SDKROOT = watchos;
SKIP_INSTALL = YES;
Expand All @@ -939,7 +936,7 @@
INFOPLIST_FILE = Configs/FuntastyKit.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.FuntastyKit.FuntastyKit-tvOS";
PRODUCT_BUNDLE_IDENTIFIER = com.funtasty.funtastykit.tvos;
PRODUCT_NAME = FuntastyKit;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
Expand All @@ -961,7 +958,7 @@
INFOPLIST_FILE = Configs/FuntastyKit.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.FuntastyKit.FuntastyKit-tvOS";
PRODUCT_BUNDLE_IDENTIFIER = com.funtasty.funtastykit.tvos;
PRODUCT_NAME = FuntastyKit;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
Expand All @@ -987,7 +984,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = "com.FuntastyKit.FuntastyKit-macOS";
PRODUCT_BUNDLE_IDENTIFIER = com.funtasty.funtastykit.macos;
PRODUCT_NAME = FuntastyKit;
SDKROOT = macosx;
SKIP_INSTALL = YES;
Expand All @@ -1010,7 +1007,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = "com.FuntastyKit.FuntastyKit-macOS";
PRODUCT_BUNDLE_IDENTIFIER = com.funtasty.funtastykit.macos;
PRODUCT_NAME = FuntastyKit;
SDKROOT = macosx;
SKIP_INSTALL = YES;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FuntastyKit

[![Build Status](https://www.bitrise.io/app/b2201bef8986b898/status.svg?token=55zmQOJfJyHGQ2nOwaQ23Q&branch=master)](https://www.bitrise.io/app/b2201bef8986b898)
[![Build Status](https://app.bitrise.io/app/b2201bef8986b898/status.svg?token=55zmQOJfJyHGQ2nOwaQ23Q&branch=master)](https://app.bitrise.io/app/b2201bef8986b898)

FuntastyKit iOS framework contains:

Expand Down
16 changes: 8 additions & 8 deletions Sources/AutoLayout/KeyboardHeightConstraint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public final class KeyboardHeightConstraint: NSLayoutConstraint {
super.awakeFromNib()

let center: NotificationCenter = .default
center.addObserver(self, selector: #selector(keyboardWillChange), name: .UIKeyboardWillHide, object: nil)
center.addObserver(self, selector: #selector(keyboardWillChange), name: .UIKeyboardWillShow, object: nil)
center.addObserver(self, selector: #selector(keyboardWillChange), name: UIResponder.keyboardWillHideNotification, object: nil)
center.addObserver(self, selector: #selector(keyboardWillChange), name: UIResponder.keyboardWillShowNotification, object: nil)
}

private var superview: UIView? {
Expand All @@ -28,7 +28,7 @@ public final class KeyboardHeightConstraint: NSLayoutConstraint {
return
}

let insetHeight = (notification.name == .UIKeyboardWillHide) ? 0.0 : height(for: userInfo) - inset
let insetHeight = (notification.name == UIResponder.keyboardWillHideNotification) ? 0.0 : height(for: userInfo) - inset

superview?.layoutIfNeeded()
UIView.animate(withDuration: duration(from: userInfo), delay: 0, options: options(from: userInfo), animations: {
Expand All @@ -45,21 +45,21 @@ public final class KeyboardHeightConstraint: NSLayoutConstraint {
}

private func height(for userInfo: [AnyHashable: Any]) -> CGFloat {
return userInfo[UIKeyboardFrameEndUserInfoKey]
return userInfo[UIResponder.keyboardFrameEndUserInfoKey]
.flatMap { $0 as? NSValue }
.map { $0.cgRectValue.height } ?? 0.0
}

private func duration(from userInfo: [AnyHashable: Any]) -> Double {
return userInfo[UIKeyboardAnimationDurationUserInfoKey]
return userInfo[UIResponder.keyboardAnimationDurationUserInfoKey]
.flatMap { $0 as? NSNumber }
.map { $0.doubleValue } ?? 0.0
}

private func options(from userInfo: [AnyHashable: Any]) -> UIViewAnimationOptions {
return userInfo[UIKeyboardAnimationCurveUserInfoKey]
private func options(from userInfo: [AnyHashable: Any]) -> UIView.AnimationOptions {
return userInfo[UIResponder.keyboardAnimationCurveUserInfoKey]
.flatMap { $0 as? NSNumber }
.map { $0.uintValue << 16 }
.map(UIViewAnimationOptions.init) ?? UIViewAnimationOptions()
.map(UIView.AnimationOptions.init) ?? UIView.AnimationOptions()
}
}
4 changes: 2 additions & 2 deletions Sources/Errors/AlertCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class AlertCoordinator: DefaultCoordinator {
case alert
case actionSheet(source: Source?)

var controllerStyle: UIAlertControllerStyle {
var controllerStyle: UIAlertController.Style {
switch self {
case .alert:
return .alert
Expand Down Expand Up @@ -90,7 +90,7 @@ public class AlertCoordinator: DefaultCoordinator {
}

public extension ErrorAction {
func alertStyle() -> UIAlertActionStyle {
func alertStyle() -> UIAlertAction.Style {
switch self.style {
case .default:
return .default
Expand Down
2 changes: 1 addition & 1 deletion Sources/Errors/UIAlertController+Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit

public extension UIAlertController {
convenience init(error: Error, preferredStyle: UIAlertControllerStyle = .alert) {
convenience init(error: Error, preferredStyle: UIAlertController.Style = .alert) {
switch error {
case let error as ResolvableError:
self.init(title: error.errorDescription ?? NSLocalizedString("Error", comment: "Error"), message: error.failureReason ?? error.localizedDescription, preferredStyle: preferredStyle)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Extensions/UIViewController+Deselection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension UITableView: Deselectable {
extension UICollectionView: Deselectable {
@nonobjc
public func selectItem(at indexPath: IndexPath?, animated: Bool) {
selectItem(at: indexPath, animated: animated, scrollPosition: UICollectionViewScrollPosition())
selectItem(at: indexPath, animated: animated, scrollPosition: UICollectionView.ScrollPosition())
}
}

Expand Down

0 comments on commit 08fb13c

Please sign in to comment.