From a71fefb590f3ad40f292d4cfc9631538195ab417 Mon Sep 17 00:00:00 2001 From: Jin Sasaki Date: Wed, 7 Dec 2016 22:30:55 +0900 Subject: [PATCH 1/3] :art: Refactor interface --- Pod/Classes/AlertBar.swift | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Pod/Classes/AlertBar.swift b/Pod/Classes/AlertBar.swift index ec53f96..8e4ffe9 100644 --- a/Pod/Classes/AlertBar.swift +++ b/Pod/Classes/AlertBar.swift @@ -19,15 +19,15 @@ public enum AlertBarType { get { switch self { case .success: - return AlertBarHelper.UIColorFromRGB(0x4CAF50) + return UIColor(0x4CAF50) case .error: - return AlertBarHelper.UIColorFromRGB(0xf44336) + return UIColor(0xf44336) case .notice: - return AlertBarHelper.UIColorFromRGB(0x2196F3) + return UIColor(0x2196F3) case .warning: - return AlertBarHelper.UIColorFromRGB(0xFFC107) + return UIColor(0xFFC107) case .info: - return AlertBarHelper.UIColorFromRGB(0x009688) + return UIColor(0x009688) case .custom(let backgroundColor, _): return backgroundColor } @@ -39,7 +39,7 @@ public enum AlertBarType { case .custom(_, let textColor): return textColor default: - return AlertBarHelper.UIColorFromRGB(0xFFFFFF) + return UIColor(0xFFFFFF) } } } @@ -130,16 +130,16 @@ open class AlertBar: UIView { }) } - open class func showError(_ error: NSError, duration: Double = 2, completion: (() -> Void)? = nil) { - let code = error.code + open class func show(error: Error, duration: Double = 2, completion: (() -> Void)? = nil) { + let code = (error as NSError).code let localizedDescription = error.localizedDescription - self.show(.error, message: "(\(code)) " + localizedDescription) + self.show(.error, message: "(\(code)) " + localizedDescription, duration: duration, completion: completion) } } -internal class AlertBarHelper { - class func UIColorFromRGB(_ rgbValue: UInt) -> UIColor { - return UIColor( +internal extension UIColor { + convenience init(_ rgbValue: UInt) { + self.init( red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0, green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0, blue: CGFloat(rgbValue & 0x0000FF) / 255.0, From 351c29bf62964dc52516e3ed75eb0adc14cfbcea Mon Sep 17 00:00:00 2001 From: Jin Sasaki Date: Wed, 7 Dec 2016 22:31:02 +0900 Subject: [PATCH 2/3] :arrow_up: Bump version --- AlertBar.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlertBar.podspec b/AlertBar.podspec index df48634..a4a70c4 100644 --- a/AlertBar.podspec +++ b/AlertBar.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "AlertBar" - s.version = "0.2.0" + s.version = "0.3.0" s.summary = "An easy alert on status bar." s.homepage = "https://github.com/jinSasaki/AlertBar" s.screenshots = "https://github.com/jinSasaki/AlertBar/raw/master/etc/demo.gif" From 7eefcdb27bad18d951220033fe53ec4d62361ce4 Mon Sep 17 00:00:00 2001 From: Jin Sasaki Date: Wed, 7 Dec 2016 22:31:10 +0900 Subject: [PATCH 3/3] :arrow_up: Update Example App to AlertBar 0.3.0 --- Example/AlertBar/ViewController.swift | 2 +- Example/Podfile.lock | 6 ++-- .../Pods/Local Podspecs/AlertBar.podspec.json | 4 +-- Example/Pods/Manifest.lock | 6 ++-- Example/Pods/Pods.xcodeproj/project.pbxproj | 32 +++++++++---------- .../AlertBar/AlertBar-umbrella.h | 2 ++ .../Target Support Files/AlertBar/Info.plist | 2 +- .../Pods-AlertBar_Example-resources.sh | 10 ++---- .../Pods-AlertBar_Example-umbrella.h | 2 ++ .../Pods-AlertBar_Tests-resources.sh | 10 ++---- .../Pods-AlertBar_Tests-umbrella.h | 2 ++ 11 files changed, 36 insertions(+), 42 deletions(-) diff --git a/Example/AlertBar/ViewController.swift b/Example/AlertBar/ViewController.swift index 0c26dcf..1461e36 100644 --- a/Example/AlertBar/ViewController.swift +++ b/Example/AlertBar/ViewController.swift @@ -16,7 +16,7 @@ class ViewController: UIViewController { } @IBAction func tapError(_ sender: AnyObject) { - AlertBar.showError(NSError(domain: "Page not found", code: 404, userInfo: nil), duration: 3) + AlertBar.show(error: NSError(domain: "Page not found", code: 404, userInfo: nil), duration: 3) } @IBAction func tapNotice(_ sender: AnyObject) { diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 9660a8a..c3d149b 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - AlertBar (0.2.0) + - AlertBar (0.3.0) DEPENDENCIES: - AlertBar (from `../`) @@ -9,8 +9,8 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - AlertBar: 3e6a111420c95e278e23e6fbe6668469e54c0be3 + AlertBar: 1e17f957b65582b7a1610e6bc2eb9c169e9466df PODFILE CHECKSUM: d0b6cb35dafa29919b756447265020670bcb91c2 -COCOAPODS: 1.1.0.rc.2 +COCOAPODS: 1.1.1 diff --git a/Example/Pods/Local Podspecs/AlertBar.podspec.json b/Example/Pods/Local Podspecs/AlertBar.podspec.json index fa4bed5..44c233b 100644 --- a/Example/Pods/Local Podspecs/AlertBar.podspec.json +++ b/Example/Pods/Local Podspecs/AlertBar.podspec.json @@ -1,6 +1,6 @@ { "name": "AlertBar", - "version": "0.2.0", + "version": "0.3.0", "summary": "An easy alert on status bar.", "homepage": "https://github.com/jinSasaki/AlertBar", "screenshots": "https://github.com/jinSasaki/AlertBar/raw/master/etc/demo.gif", @@ -10,7 +10,7 @@ }, "source": { "git": "https://github.com/jinSasaki/AlertBar.git", - "tag": "0.2.0" + "tag": "0.3.0" }, "social_media_url": "https://twitter.com/sasakky_j", "platforms": { diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock index 9660a8a..c3d149b 100644 --- a/Example/Pods/Manifest.lock +++ b/Example/Pods/Manifest.lock @@ -1,5 +1,5 @@ PODS: - - AlertBar (0.2.0) + - AlertBar (0.3.0) DEPENDENCIES: - AlertBar (from `../`) @@ -9,8 +9,8 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - AlertBar: 3e6a111420c95e278e23e6fbe6668469e54c0be3 + AlertBar: 1e17f957b65582b7a1610e6bc2eb9c169e9466df PODFILE CHECKSUM: d0b6cb35dafa29919b756447265020670bcb91c2 -COCOAPODS: 1.1.0.rc.2 +COCOAPODS: 1.1.1 diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 02bbaf0..324d247 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -8,14 +8,14 @@ /* Begin PBXBuildFile section */ 0155D7BA05F6329354DE48EB41AD6BA3 /* AlertBar-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A6C06DA8397A6D36C2EA3FAE067E818 /* AlertBar-dummy.m */; }; - 2E90228D7F66FBDCD9DC5CA2FAA415C3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEC22C73C1608DFA5D5D78BDCB218219 /* Foundation.framework */; }; - 52041D43C9FA5BC7ADE66AC2E0E392BA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEC22C73C1608DFA5D5D78BDCB218219 /* Foundation.framework */; }; + 52B8A10EB91EC62A179F3227864F93E8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */; }; 5A3DBB57C2F0DEA13C028A98FDF9D21E /* AlertBar-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 004F3DDBC807DB751CEE2E5CB2724E7C /* AlertBar-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5AB26352DEBA95E1D55F510477CBDC4E /* Pods-AlertBar_Tests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = ECB4D9FA0F1C52870516AB9B16C05A17 /* Pods-AlertBar_Tests-dummy.m */; }; + 7AA82A72C19E49E34814692A18AFB78B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */; }; 871B876172463E4C59D48620FCFF8F5F /* AlertBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B4ECAC7A6FDE6071A65A449FF306520 /* AlertBar.swift */; }; + 893824D5A9BA4D2C85153EA08E9F88A3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */; }; 9EC6D013B1A7CD98A6162EE4E42C93F2 /* Pods-AlertBar_Tests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 9090D6CBC0028FB715F1E8A95E31565E /* Pods-AlertBar_Tests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; AAC2FDE34C12E9D87CE9E7A5D40D95D6 /* Pods-AlertBar_Example-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D2583ED297B742EEF36010F78A85A18 /* Pods-AlertBar_Example-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E920A7708A2BF62350F2673C56C59F3F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEC22C73C1608DFA5D5D78BDCB218219 /* Foundation.framework */; }; FAEB6BA2EB5EAA777A4314A2EECEB646 /* Pods-AlertBar_Example-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 53911A4E0401520A89DC497EA05648EB /* Pods-AlertBar_Example-dummy.m */; }; /* End PBXBuildFile section */ @@ -61,7 +61,7 @@ ADEE9A59ABCB216DD05B0178078B7E97 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AF4D6DFA57341CB845865F04DF3992DD /* Pods-AlertBar_Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-AlertBar_Tests-acknowledgements.markdown"; sourceTree = ""; }; B2CAA8321B44E0173D56584DDC3904EF /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - CEC22C73C1608DFA5D5D78BDCB218219 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; D2DF3B86C1B6BDA5F0D7313AA3463827 /* Pods-AlertBar_Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-AlertBar_Tests-frameworks.sh"; sourceTree = ""; }; DC59D3C5135976E1D007A0B31D173447 /* Pods_AlertBar_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AlertBar_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E899B657990107B765E02C8FCEDA6E7D /* Pods-AlertBar_Example-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-AlertBar_Example-acknowledgements.markdown"; sourceTree = ""; }; @@ -76,7 +76,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 2E90228D7F66FBDCD9DC5CA2FAA415C3 /* Foundation.framework in Frameworks */, + 893824D5A9BA4D2C85153EA08E9F88A3 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -84,7 +84,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E920A7708A2BF62350F2673C56C59F3F /* Foundation.framework in Frameworks */, + 52B8A10EB91EC62A179F3227864F93E8 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -92,7 +92,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 52041D43C9FA5BC7ADE66AC2E0E392BA /* Foundation.framework in Frameworks */, + 7AA82A72C19E49E34814692A18AFB78B /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -125,14 +125,6 @@ path = Classes; sourceTree = ""; }; - 3DCAB2B7CDE207B3958B6CB957FCC758 /* iOS */ = { - isa = PBXGroup; - children = ( - CEC22C73C1608DFA5D5D78BDCB218219 /* Foundation.framework */, - ); - name = iOS; - sourceTree = ""; - }; 595C4FEE47FEBAE99FEC8EBA3A7294BF /* AlertBar */ = { isa = PBXGroup; children = ( @@ -161,6 +153,14 @@ path = "Target Support Files/Pods-AlertBar_Tests"; sourceTree = ""; }; + 7531C8F8DE19F1AA3C8A7AC97A91DC29 /* iOS */ = { + isa = PBXGroup; + children = ( + CBB3DE36805AF21409EC968A9691732F /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; 78001211006781A3F0DFEE75E9AC2B3F /* Products */ = { isa = PBXGroup; children = ( @@ -210,7 +210,7 @@ BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { isa = PBXGroup; children = ( - 3DCAB2B7CDE207B3958B6CB957FCC758 /* iOS */, + 7531C8F8DE19F1AA3C8A7AC97A91DC29 /* iOS */, ); name = Frameworks; sourceTree = ""; diff --git a/Example/Pods/Target Support Files/AlertBar/AlertBar-umbrella.h b/Example/Pods/Target Support Files/AlertBar/AlertBar-umbrella.h index 44d0543..3a48ea1 100644 --- a/Example/Pods/Target Support Files/AlertBar/AlertBar-umbrella.h +++ b/Example/Pods/Target Support Files/AlertBar/AlertBar-umbrella.h @@ -1,4 +1,6 @@ +#ifdef __OBJC__ #import +#endif FOUNDATION_EXPORT double AlertBarVersionNumber; diff --git a/Example/Pods/Target Support Files/AlertBar/Info.plist b/Example/Pods/Target Support Files/AlertBar/Info.plist index 0d7bfa2..f92230d 100644 --- a/Example/Pods/Target Support Files/AlertBar/Info.plist +++ b/Example/Pods/Target Support Files/AlertBar/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.2.0 + 0.3.0 CFBundleSignature ???? CFBundleVersion diff --git a/Example/Pods/Target Support Files/Pods-AlertBar_Example/Pods-AlertBar_Example-resources.sh b/Example/Pods/Target Support Files/Pods-AlertBar_Example/Pods-AlertBar_Example-resources.sh index 0a15615..25e9d37 100755 --- a/Example/Pods/Target Support Files/Pods-AlertBar_Example/Pods-AlertBar_Example-resources.sh +++ b/Example/Pods/Target Support Files/Pods-AlertBar_Example/Pods-AlertBar_Example-resources.sh @@ -23,12 +23,6 @@ case "${TARGETED_DEVICE_FAMILY}" in ;; esac -realpath() { - DIRECTORY="$(cd "${1%/*}" && pwd)" - FILENAME="${1##*/}" - echo "$DIRECTORY/$FILENAME" -} - install_resource() { if [[ "$1" = /* ]] ; then @@ -70,7 +64,7 @@ EOM xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" ;; *.xcassets) - ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH") + ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") ;; *) @@ -93,7 +87,7 @@ then # Find all other xcassets (this unfortunately includes those of path pods and other targets). OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) while read line; do - if [[ $line != "`realpath $PODS_ROOT`*" ]]; then + if [[ $line != "${PODS_ROOT}*" ]]; then XCASSET_FILES+=("$line") fi done <<<"$OTHER_XCASSETS" diff --git a/Example/Pods/Target Support Files/Pods-AlertBar_Example/Pods-AlertBar_Example-umbrella.h b/Example/Pods/Target Support Files/Pods-AlertBar_Example/Pods-AlertBar_Example-umbrella.h index 217ba7e..363682a 100644 --- a/Example/Pods/Target Support Files/Pods-AlertBar_Example/Pods-AlertBar_Example-umbrella.h +++ b/Example/Pods/Target Support Files/Pods-AlertBar_Example/Pods-AlertBar_Example-umbrella.h @@ -1,4 +1,6 @@ +#ifdef __OBJC__ #import +#endif FOUNDATION_EXPORT double Pods_AlertBar_ExampleVersionNumber; diff --git a/Example/Pods/Target Support Files/Pods-AlertBar_Tests/Pods-AlertBar_Tests-resources.sh b/Example/Pods/Target Support Files/Pods-AlertBar_Tests/Pods-AlertBar_Tests-resources.sh index 0a15615..25e9d37 100755 --- a/Example/Pods/Target Support Files/Pods-AlertBar_Tests/Pods-AlertBar_Tests-resources.sh +++ b/Example/Pods/Target Support Files/Pods-AlertBar_Tests/Pods-AlertBar_Tests-resources.sh @@ -23,12 +23,6 @@ case "${TARGETED_DEVICE_FAMILY}" in ;; esac -realpath() { - DIRECTORY="$(cd "${1%/*}" && pwd)" - FILENAME="${1##*/}" - echo "$DIRECTORY/$FILENAME" -} - install_resource() { if [[ "$1" = /* ]] ; then @@ -70,7 +64,7 @@ EOM xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" ;; *.xcassets) - ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH") + ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") ;; *) @@ -93,7 +87,7 @@ then # Find all other xcassets (this unfortunately includes those of path pods and other targets). OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) while read line; do - if [[ $line != "`realpath $PODS_ROOT`*" ]]; then + if [[ $line != "${PODS_ROOT}*" ]]; then XCASSET_FILES+=("$line") fi done <<<"$OTHER_XCASSETS" diff --git a/Example/Pods/Target Support Files/Pods-AlertBar_Tests/Pods-AlertBar_Tests-umbrella.h b/Example/Pods/Target Support Files/Pods-AlertBar_Tests/Pods-AlertBar_Tests-umbrella.h index f1e2cd6..ef1ec95 100644 --- a/Example/Pods/Target Support Files/Pods-AlertBar_Tests/Pods-AlertBar_Tests-umbrella.h +++ b/Example/Pods/Target Support Files/Pods-AlertBar_Tests/Pods-AlertBar_Tests-umbrella.h @@ -1,4 +1,6 @@ +#ifdef __OBJC__ #import +#endif FOUNDATION_EXPORT double Pods_AlertBar_TestsVersionNumber;