Skip to content

Commit

Permalink
updating to swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorJera committed Oct 26, 2018
1 parent d653fe1 commit 387bca3
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.2
41 changes: 31 additions & 10 deletions Example/Malert.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -406,18 +406,19 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = KXWH4SC5H2;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
607FACE41AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = KXWH4SC5H2;
LastSwiftMigration = 0900;
LastSwiftMigration = 1000;
TestTargetID = 607FACCF1AFB9204008FA782;
};
};
Expand Down Expand Up @@ -639,14 +640,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -686,14 +695,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -724,15 +741,18 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = KXWH4SC5H2;
INFOPLIST_FILE = Malert/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.demo.Malert;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -742,15 +762,18 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = KXWH4SC5H2;
INFOPLIST_FILE = Malert/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.demo.Malert;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -771,8 +794,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -789,8 +811,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 2 additions & 4 deletions Example/Malert/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import Malert
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
MalertView.appearance().buttonsHeight = 50

let window = UIWindow()
Expand Down
2 changes: 1 addition & 1 deletion Example/Malert/base/BaseNavigationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BaseNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
navigationBar.isTranslucent = false
navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
navigationBar.tintColor = .white
}
}
2 changes: 1 addition & 1 deletion Malert.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Pod::Spec.new do |s|
s.name = 'Malert'
s.version = '3.0'
s.version = '3.1'
s.summary = 'A simple, easy and very customizable alert'
s.description = <<-DESC
Malert came to facilitate make custom alert views, introducing as `UIAlertController`.
Expand Down
6 changes: 3 additions & 3 deletions Malert/Classes/Base/BaseMalertViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ public class BaseMalertViewController: UIViewController {
private(set) var keyboardRect = CGRect.zero

func listenKeyboard(){
NotificationCenter.default.addObserver(self, selector: #selector(BaseMalertViewController.keyboardWillShow(sender:)), name: .UIKeyboardWillChangeFrame, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(BaseMalertViewController.keyboardWillHide(sender:)), name: .UIKeyboardWillHide, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(BaseMalertViewController.keyboardWillShow(sender:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(BaseMalertViewController.keyboardWillHide(sender:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}

@objc func keyboardWillShow(sender: NSNotification){
guard let userInfo = sender.userInfo else {
return
}

if let keyboardRect = (userInfo[UIKeyboardFrameEndUserInfoKey] as AnyObject).cgRectValue{
if let keyboardRect = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as AnyObject).cgRectValue{
self.keyboardRect = keyboardRect
}
}
Expand Down
4 changes: 2 additions & 2 deletions Malert/Classes/Malert/Malert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class Malert: BaseMalertViewController {
self.transitioningDelegate = malertPresentationManager
}

required convenience public init?(coder aDecoder: NSCoder) {
public required convenience init?(coder aDecoder: NSCoder) {
self.init(coder: aDecoder)
}

Expand Down Expand Up @@ -161,7 +161,7 @@ extension Malert {
set { malertView.buttonsBottomMargin = newValue }
}

public var buttonsAxis: UILayoutConstraintAxis {
public var buttonsAxis: NSLayoutConstraint.Axis {
get { return malertView.buttonsAxis }
set { malertView.buttonsAxis = newValue }
}
Expand Down
6 changes: 3 additions & 3 deletions Malert/Classes/MalertView/MalertView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,19 @@ extension MalertView {
}

/// Buttons distribution in stack view
@objc public dynamic var buttonsDistribution: UIStackViewDistribution {
@objc public dynamic var buttonsDistribution: UIStackView.Distribution {
get { return buttonsStackView.distribution }
set { buttonsStackView.distribution = newValue }
}

/// Buttons aligns in stack view
@objc public dynamic var buttonsAligment: UIStackViewAlignment {
@objc public dynamic var buttonsAligment: UIStackView.Alignment {
get { return buttonsStackView.alignment }
set { buttonsStackView.alignment = newValue }
}

/// Buttons axis in stack view
@objc public dynamic var buttonsAxis: UILayoutConstraintAxis {
@objc public dynamic var buttonsAxis: NSLayoutConstraint.Axis {
get { return buttonsStackView.axis }
set { buttonsStackView.axis = newValue }
}
Expand Down
2 changes: 1 addition & 1 deletion Malert/Classes/Util/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension UILabel {

extension UIStackView {

static func defaultStack(axis: UILayoutConstraintAxis) -> UIStackView {
static func defaultStack(axis: NSLayoutConstraint.Axis) -> UIStackView {
let stack = UIStackView()
stack.distribution = .fillEqually
stack.alignment = .fill
Expand Down

0 comments on commit 387bca3

Please sign in to comment.