Skip to content

Commit

Permalink
Merge pull request #6 from mshrwtnb/swift4.2
Browse files Browse the repository at this point in the history
Xcode 10.0 Swift4.2 Support
  • Loading branch information
mshrwtnb authored Sep 25, 2018
2 parents a7da10a + db2c733 commit a5f55ea
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 36 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
2 changes: 1 addition & 1 deletion ALRT.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ALRT"
s.version = "1.2.0"
s.version = "1.3.0"
s.summary = "ALRT is an easy-to-create UIAlertController framework."
s.description = <<-DESC
* Easy-to-Create. As easy as 'ALRT.create(.alert).addOK().show()''
Expand Down
4 changes: 2 additions & 2 deletions ALRT.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -294,7 +294,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.nsocean.ALRT;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
38 changes: 19 additions & 19 deletions ALRT/ALRT.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ open class ALRT {

fileprivate init(){}

fileprivate init(title: String?, message: String?, preferredStyle: UIAlertControllerStyle) {
fileprivate init(title: String?, message: String?, preferredStyle: UIAlertController.Style) {
self.alert = UIAlertController(title: title,
message: message,
preferredStyle: preferredStyle)
Expand All @@ -51,9 +51,9 @@ open class ALRT {
- returns: ALRT
*/

open class func create(_ style: UIAlertControllerStyle,
title: String? = nil,
message: String? = nil) -> ALRT {
open class func create(_ style: UIAlertController.Style,
title: String? = nil,
message: String? = nil) -> ALRT {

return ALRT(title: title, message: message, preferredStyle: style)
}
Expand Down Expand Up @@ -85,7 +85,7 @@ open class ALRT {
*/

@discardableResult
open func addTextField(_ configurationHandler: ((_ textField: UITextField) -> Void)?) -> Self{
open func addTextField(_ configurationHandler: ((_ textField: UITextField) -> Void)?) -> Self {
guard alert?.preferredStyle == .alert else {
return self
}
Expand Down Expand Up @@ -115,9 +115,9 @@ open class ALRT {

@discardableResult
open func addAction(_ title: String?,
style: UIAlertActionStyle = .default,
preferred: Bool = false,
handler: ((_ action: UIAlertAction, _ textFields: [UITextField]?) -> Void)? = nil) -> Self {
style: UIAlertAction.Style = .default,
preferred: Bool = false,
handler: ((_ action: UIAlertAction, _ textFields: [UITextField]?) -> Void)? = nil) -> Self {

let action = UIAlertAction(title: title, style: style) { action in
handler?(action, self.alert?.preferredStyle == .alert ? self.alert?.textFields : nil)
Expand Down Expand Up @@ -148,9 +148,9 @@ open class ALRT {

@discardableResult
open func addOK(_ title: String = "OK",
style: UIAlertActionStyle = .default,
preferred: Bool = false,
handler:((_ action: UIAlertAction, _ textFields: [UITextField]?) -> Void)? = nil) -> Self {
style: UIAlertAction.Style = .default,
preferred: Bool = false,
handler:((_ action: UIAlertAction, _ textFields: [UITextField]?) -> Void)? = nil) -> Self {

return addAction(title, style: style, preferred: preferred, handler: handler)
}
Expand All @@ -168,9 +168,9 @@ open class ALRT {

@discardableResult
open func addCancel(_ title: String = "Cancel",
style: UIAlertActionStyle = .cancel,
preferred: Bool = false,
handler: ((_ action: UIAlertAction, _ textFields: [UITextField]?) -> Void)? = nil) -> Self {
style: UIAlertAction.Style = .cancel,
preferred: Bool = false,
handler: ((_ action: UIAlertAction, _ textFields: [UITextField]?) -> Void)? = nil) -> Self {

return addAction(title, style: style, preferred: preferred, handler: handler)
}
Expand All @@ -188,9 +188,9 @@ open class ALRT {

@discardableResult
open func addDestructive(_ title: String?,
style: UIAlertActionStyle = .destructive,
preferred: Bool = false,
handler: ((_ action: UIAlertAction, _ textFields: [UITextField]?) -> Void)? = nil)-> Self {
style: UIAlertAction.Style = .destructive,
preferred: Bool = false,
handler: ((_ action: UIAlertAction, _ textFields: [UITextField]?) -> Void)? = nil)-> Self {

return addAction(title, style: style, preferred: preferred, handler: handler)
}
Expand Down Expand Up @@ -224,8 +224,8 @@ open class ALRT {
*/

open func show(_ viewControllerToPresent: UIViewController? = nil,
animated: Bool = true,
completion: @escaping ((ALRT.Result) -> Void) = { _ in } ) {
animated: Bool = true,
completion: @escaping ((ALRT.Result) -> Void) = { _ in } ) {

guard let alert = self.alert else {
completion(.failure(.alertControllerNil))
Expand Down
2 changes: 1 addition & 1 deletion ALRT/Info.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.2</string>
<string>1.3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
20 changes: 17 additions & 3 deletions Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
DF17F7E71D4C18DE001DF68B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DF17F7E61D4C18DE001DF68B /* Assets.xcassets */; };
DF17F7EA1D4C18DE001DF68B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DF17F7E81D4C18DE001DF68B /* LaunchScreen.storyboard */; };
DF17F8001D4C228F001DF68B /* ALRT.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF17F7FD1D4C228F001DF68B /* ALRT.swift */; };
DF17F8011D4C228F001DF68B /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = DF17F7FE1D4C228F001DF68B /* Info.plist */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -108,7 +107,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0810;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Masahiro Watanabe";
TargetAttributes = {
DF17F7DB1D4C18DE001DF68B = {
Expand Down Expand Up @@ -141,7 +140,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DF17F8011D4C228F001DF68B /* Info.plist in Resources */,
DF17F7EA1D4C18DE001DF68B /* LaunchScreen.storyboard in Resources */,
DF17F7E71D4C18DE001DF68B /* Assets.xcassets in Resources */,
DF17F7E51D4C18DE001DF68B /* Main.storyboard in Resources */,
Expand Down Expand Up @@ -192,14 +190,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 @@ -241,14 +247,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
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>
6 changes: 3 additions & 3 deletions Demo/Demo.xcodeproj/xcshareddata/xcschemes/Demo.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0810"
LastUpgradeVersion = "1000"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,8 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
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 = "0820"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ALRT
<img width=300 src="https://raw.githubusercontent.com/wiki/mshrwtnb/ALRT/logobanner.png">

ALRTは、UIAlertControllerをシンプルに呼び出すことができるライブラリです。
ALRTは、UIAlertControllerをシンプルに呼び出すことができるライブラリです。
`.alert`, `.actionSheet`のどちらも簡単に作成、表示することができます。

Expand Down Expand Up @@ -76,8 +76,8 @@ ALRT.create(.alert, title: "Login", message: "Please enter your credentials")
```

## 環境
* Xcode 9.3
* Swift 4.1
* Xcode 10.0
* Swift 4.2
* iOS 9.0以上

## インストール方法
Expand All @@ -90,8 +90,8 @@ pod "ALRT"

### Carthage
```
github "mshrwtnb/ALRT" ~> 1.2.0
github "mshrwtnb/ALRT" ~> 1.3.0
```

## Multilanguages Documents
English version can be found [here](https://github.com/mshrwtnb/ALRT/blob/swift4/README_en.md)
English version can be found [here](https://github.com/mshrwtnb/ALRT/blob/master/README_en.md)

0 comments on commit a5f55ea

Please sign in to comment.