├── .gitignore ├── Example ├── Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── Podfile └── Podfile.lock ├── LICENSE ├── README.md ├── RxUIAlertController.podspec └── Source └── RxAlertController.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | 67 | Example/Pods 68 | Example/Example.xcworkspace 69 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 68B6955B1DFA643F00D3BEA7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68B6955A1DFA643F00D3BEA7 /* AppDelegate.swift */; }; 11 | 68B6955D1DFA643F00D3BEA7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68B6955C1DFA643F00D3BEA7 /* ViewController.swift */; }; 12 | 68B695601DFA643F00D3BEA7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 68B6955E1DFA643F00D3BEA7 /* Main.storyboard */; }; 13 | 68B695621DFA643F00D3BEA7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 68B695611DFA643F00D3BEA7 /* Assets.xcassets */; }; 14 | 68B695651DFA643F00D3BEA7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 68B695631DFA643F00D3BEA7 /* LaunchScreen.storyboard */; }; 15 | 86F7B40A7E48AAE2D1B50816 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D1EC332811ADA407E322E331 /* Pods_Example.framework */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 68B695571DFA643F00D3BEA7 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 68B6955A1DFA643F00D3BEA7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 21 | 68B6955C1DFA643F00D3BEA7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 22 | 68B6955F1DFA643F00D3BEA7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 23 | 68B695611DFA643F00D3BEA7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | 68B695641DFA643F00D3BEA7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 25 | 68B695661DFA643F00D3BEA7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | 7349CB7A68A5284CF0A5DB1B /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; 27 | D1EC332811ADA407E322E331 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | E40E8156D8154FD47F1848FB /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 68B695541DFA643F00D3BEA7 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | 86F7B40A7E48AAE2D1B50816 /* Pods_Example.framework in Frameworks */, 37 | ); 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXFrameworksBuildPhase section */ 41 | 42 | /* Begin PBXGroup section */ 43 | 1F033597BDFC71F3B755E03B /* Frameworks */ = { 44 | isa = PBXGroup; 45 | children = ( 46 | D1EC332811ADA407E322E331 /* Pods_Example.framework */, 47 | ); 48 | name = Frameworks; 49 | sourceTree = ""; 50 | }; 51 | 2E7D528888FCEC4BAE7A1A67 /* Pods */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | E40E8156D8154FD47F1848FB /* Pods-Example.debug.xcconfig */, 55 | 7349CB7A68A5284CF0A5DB1B /* Pods-Example.release.xcconfig */, 56 | ); 57 | name = Pods; 58 | sourceTree = ""; 59 | }; 60 | 68B6954E1DFA643F00D3BEA7 = { 61 | isa = PBXGroup; 62 | children = ( 63 | 68B695591DFA643F00D3BEA7 /* Example */, 64 | 68B695581DFA643F00D3BEA7 /* Products */, 65 | 2E7D528888FCEC4BAE7A1A67 /* Pods */, 66 | 1F033597BDFC71F3B755E03B /* Frameworks */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 68B695581DFA643F00D3BEA7 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 68B695571DFA643F00D3BEA7 /* Example.app */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | 68B695591DFA643F00D3BEA7 /* Example */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 68B6955A1DFA643F00D3BEA7 /* AppDelegate.swift */, 82 | 68B6955C1DFA643F00D3BEA7 /* ViewController.swift */, 83 | 68B6955E1DFA643F00D3BEA7 /* Main.storyboard */, 84 | 68B695611DFA643F00D3BEA7 /* Assets.xcassets */, 85 | 68B695631DFA643F00D3BEA7 /* LaunchScreen.storyboard */, 86 | 68B695661DFA643F00D3BEA7 /* Info.plist */, 87 | ); 88 | path = Example; 89 | sourceTree = ""; 90 | }; 91 | /* End PBXGroup section */ 92 | 93 | /* Begin PBXNativeTarget section */ 94 | 68B695561DFA643F00D3BEA7 /* Example */ = { 95 | isa = PBXNativeTarget; 96 | buildConfigurationList = 68B695691DFA643F00D3BEA7 /* Build configuration list for PBXNativeTarget "Example" */; 97 | buildPhases = ( 98 | AE49EF36DBB328161162ECEE /* [CP] Check Pods Manifest.lock */, 99 | 68B695531DFA643F00D3BEA7 /* Sources */, 100 | 68B695541DFA643F00D3BEA7 /* Frameworks */, 101 | 68B695551DFA643F00D3BEA7 /* Resources */, 102 | 5A6F3A57A5B4341A0D73BF0E /* [CP] Embed Pods Frameworks */, 103 | 4D3CBFE2048DCCC99B4492A9 /* [CP] Copy Pods Resources */, 104 | ); 105 | buildRules = ( 106 | ); 107 | dependencies = ( 108 | ); 109 | name = Example; 110 | productName = Example; 111 | productReference = 68B695571DFA643F00D3BEA7 /* Example.app */; 112 | productType = "com.apple.product-type.application"; 113 | }; 114 | /* End PBXNativeTarget section */ 115 | 116 | /* Begin PBXProject section */ 117 | 68B6954F1DFA643F00D3BEA7 /* Project object */ = { 118 | isa = PBXProject; 119 | attributes = { 120 | LastSwiftUpdateCheck = 0810; 121 | LastUpgradeCheck = 0910; 122 | ORGANIZATIONNAME = ebt; 123 | TargetAttributes = { 124 | 68B695561DFA643F00D3BEA7 = { 125 | CreatedOnToolsVersion = 8.1; 126 | DevelopmentTeam = AY957U87NM; 127 | LastSwiftMigration = 0910; 128 | ProvisioningStyle = Automatic; 129 | }; 130 | }; 131 | }; 132 | buildConfigurationList = 68B695521DFA643F00D3BEA7 /* Build configuration list for PBXProject "Example" */; 133 | compatibilityVersion = "Xcode 3.2"; 134 | developmentRegion = English; 135 | hasScannedForEncodings = 0; 136 | knownRegions = ( 137 | en, 138 | Base, 139 | ); 140 | mainGroup = 68B6954E1DFA643F00D3BEA7; 141 | productRefGroup = 68B695581DFA643F00D3BEA7 /* Products */; 142 | projectDirPath = ""; 143 | projectRoot = ""; 144 | targets = ( 145 | 68B695561DFA643F00D3BEA7 /* Example */, 146 | ); 147 | }; 148 | /* End PBXProject section */ 149 | 150 | /* Begin PBXResourcesBuildPhase section */ 151 | 68B695551DFA643F00D3BEA7 /* Resources */ = { 152 | isa = PBXResourcesBuildPhase; 153 | buildActionMask = 2147483647; 154 | files = ( 155 | 68B695651DFA643F00D3BEA7 /* LaunchScreen.storyboard in Resources */, 156 | 68B695621DFA643F00D3BEA7 /* Assets.xcassets in Resources */, 157 | 68B695601DFA643F00D3BEA7 /* Main.storyboard in Resources */, 158 | ); 159 | runOnlyForDeploymentPostprocessing = 0; 160 | }; 161 | /* End PBXResourcesBuildPhase section */ 162 | 163 | /* Begin PBXShellScriptBuildPhase section */ 164 | 4D3CBFE2048DCCC99B4492A9 /* [CP] Copy Pods Resources */ = { 165 | isa = PBXShellScriptBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | ); 169 | inputPaths = ( 170 | ); 171 | name = "[CP] Copy Pods Resources"; 172 | outputPaths = ( 173 | ); 174 | runOnlyForDeploymentPostprocessing = 0; 175 | shellPath = /bin/sh; 176 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-resources.sh\"\n"; 177 | showEnvVarsInLog = 0; 178 | }; 179 | 5A6F3A57A5B4341A0D73BF0E /* [CP] Embed Pods Frameworks */ = { 180 | isa = PBXShellScriptBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | ); 184 | inputPaths = ( 185 | "${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh", 186 | "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", 187 | "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", 188 | "${BUILT_PRODUCTS_DIR}/RxUIAlertController/RxUIAlertController.framework", 189 | ); 190 | name = "[CP] Embed Pods Frameworks"; 191 | outputPaths = ( 192 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", 193 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", 194 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxUIAlertController.framework", 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; 199 | showEnvVarsInLog = 0; 200 | }; 201 | AE49EF36DBB328161162ECEE /* [CP] Check Pods Manifest.lock */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 208 | "${PODS_ROOT}/Manifest.lock", 209 | ); 210 | name = "[CP] Check Pods Manifest.lock"; 211 | outputPaths = ( 212 | "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt", 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | shellPath = /bin/sh; 216 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 217 | showEnvVarsInLog = 0; 218 | }; 219 | /* End PBXShellScriptBuildPhase section */ 220 | 221 | /* Begin PBXSourcesBuildPhase section */ 222 | 68B695531DFA643F00D3BEA7 /* Sources */ = { 223 | isa = PBXSourcesBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | 68B6955D1DFA643F00D3BEA7 /* ViewController.swift in Sources */, 227 | 68B6955B1DFA643F00D3BEA7 /* AppDelegate.swift in Sources */, 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | }; 231 | /* End PBXSourcesBuildPhase section */ 232 | 233 | /* Begin PBXVariantGroup section */ 234 | 68B6955E1DFA643F00D3BEA7 /* Main.storyboard */ = { 235 | isa = PBXVariantGroup; 236 | children = ( 237 | 68B6955F1DFA643F00D3BEA7 /* Base */, 238 | ); 239 | name = Main.storyboard; 240 | sourceTree = ""; 241 | }; 242 | 68B695631DFA643F00D3BEA7 /* LaunchScreen.storyboard */ = { 243 | isa = PBXVariantGroup; 244 | children = ( 245 | 68B695641DFA643F00D3BEA7 /* Base */, 246 | ); 247 | name = LaunchScreen.storyboard; 248 | sourceTree = ""; 249 | }; 250 | /* End PBXVariantGroup section */ 251 | 252 | /* Begin XCBuildConfiguration section */ 253 | 68B695671DFA643F00D3BEA7 /* Debug */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | ALWAYS_SEARCH_USER_PATHS = NO; 257 | CLANG_ANALYZER_NONNULL = YES; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 263 | CLANG_WARN_BOOL_CONVERSION = YES; 264 | CLANG_WARN_COMMA = YES; 265 | CLANG_WARN_CONSTANT_CONVERSION = YES; 266 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 267 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 268 | CLANG_WARN_EMPTY_BODY = YES; 269 | CLANG_WARN_ENUM_CONVERSION = YES; 270 | CLANG_WARN_INFINITE_RECURSION = YES; 271 | CLANG_WARN_INT_CONVERSION = YES; 272 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 273 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 274 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 275 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 276 | CLANG_WARN_STRICT_PROTOTYPES = YES; 277 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 278 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 279 | CLANG_WARN_UNREACHABLE_CODE = YES; 280 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 281 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 282 | COPY_PHASE_STRIP = NO; 283 | DEBUG_INFORMATION_FORMAT = dwarf; 284 | ENABLE_STRICT_OBJC_MSGSEND = YES; 285 | ENABLE_TESTABILITY = YES; 286 | GCC_C_LANGUAGE_STANDARD = gnu99; 287 | GCC_DYNAMIC_NO_PIC = NO; 288 | GCC_NO_COMMON_BLOCKS = YES; 289 | GCC_OPTIMIZATION_LEVEL = 0; 290 | GCC_PREPROCESSOR_DEFINITIONS = ( 291 | "DEBUG=1", 292 | "$(inherited)", 293 | ); 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 301 | MTL_ENABLE_DEBUG_INFO = YES; 302 | ONLY_ACTIVE_ARCH = YES; 303 | SDKROOT = iphoneos; 304 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 305 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 306 | }; 307 | name = Debug; 308 | }; 309 | 68B695681DFA643F00D3BEA7 /* Release */ = { 310 | isa = XCBuildConfiguration; 311 | buildSettings = { 312 | ALWAYS_SEARCH_USER_PATHS = NO; 313 | CLANG_ANALYZER_NONNULL = YES; 314 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 315 | CLANG_CXX_LIBRARY = "libc++"; 316 | CLANG_ENABLE_MODULES = YES; 317 | CLANG_ENABLE_OBJC_ARC = YES; 318 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 319 | CLANG_WARN_BOOL_CONVERSION = YES; 320 | CLANG_WARN_COMMA = YES; 321 | CLANG_WARN_CONSTANT_CONVERSION = YES; 322 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 323 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 324 | CLANG_WARN_EMPTY_BODY = YES; 325 | CLANG_WARN_ENUM_CONVERSION = YES; 326 | CLANG_WARN_INFINITE_RECURSION = YES; 327 | CLANG_WARN_INT_CONVERSION = YES; 328 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 329 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 330 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 331 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 332 | CLANG_WARN_STRICT_PROTOTYPES = YES; 333 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 334 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 335 | CLANG_WARN_UNREACHABLE_CODE = YES; 336 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 337 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 338 | COPY_PHASE_STRIP = NO; 339 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 340 | ENABLE_NS_ASSERTIONS = NO; 341 | ENABLE_STRICT_OBJC_MSGSEND = YES; 342 | GCC_C_LANGUAGE_STANDARD = gnu99; 343 | GCC_NO_COMMON_BLOCKS = YES; 344 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 345 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 346 | GCC_WARN_UNDECLARED_SELECTOR = YES; 347 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 348 | GCC_WARN_UNUSED_FUNCTION = YES; 349 | GCC_WARN_UNUSED_VARIABLE = YES; 350 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 351 | MTL_ENABLE_DEBUG_INFO = NO; 352 | SDKROOT = iphoneos; 353 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 354 | VALIDATE_PRODUCT = YES; 355 | }; 356 | name = Release; 357 | }; 358 | 68B6956A1DFA643F00D3BEA7 /* Debug */ = { 359 | isa = XCBuildConfiguration; 360 | baseConfigurationReference = E40E8156D8154FD47F1848FB /* Pods-Example.debug.xcconfig */; 361 | buildSettings = { 362 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 363 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 364 | DEVELOPMENT_TEAM = AY957U87NM; 365 | INFOPLIST_FILE = Example/Info.plist; 366 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 367 | PRODUCT_BUNDLE_IDENTIFIER = com.morenotepad.Example; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 370 | SWIFT_VERSION = 4.0; 371 | TARGETED_DEVICE_FAMILY = "1,2"; 372 | }; 373 | name = Debug; 374 | }; 375 | 68B6956B1DFA643F00D3BEA7 /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | baseConfigurationReference = 7349CB7A68A5284CF0A5DB1B /* Pods-Example.release.xcconfig */; 378 | buildSettings = { 379 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 380 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 381 | DEVELOPMENT_TEAM = AY957U87NM; 382 | INFOPLIST_FILE = Example/Info.plist; 383 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 384 | PRODUCT_BUNDLE_IDENTIFIER = com.morenotepad.Example; 385 | PRODUCT_NAME = "$(TARGET_NAME)"; 386 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 387 | SWIFT_VERSION = 4.0; 388 | TARGETED_DEVICE_FAMILY = "1,2"; 389 | }; 390 | name = Release; 391 | }; 392 | /* End XCBuildConfiguration section */ 393 | 394 | /* Begin XCConfigurationList section */ 395 | 68B695521DFA643F00D3BEA7 /* Build configuration list for PBXProject "Example" */ = { 396 | isa = XCConfigurationList; 397 | buildConfigurations = ( 398 | 68B695671DFA643F00D3BEA7 /* Debug */, 399 | 68B695681DFA643F00D3BEA7 /* Release */, 400 | ); 401 | defaultConfigurationIsVisible = 0; 402 | defaultConfigurationName = Release; 403 | }; 404 | 68B695691DFA643F00D3BEA7 /* Build configuration list for PBXNativeTarget "Example" */ = { 405 | isa = XCConfigurationList; 406 | buildConfigurations = ( 407 | 68B6956A1DFA643F00D3BEA7 /* Debug */, 408 | 68B6956B1DFA643F00D3BEA7 /* Release */, 409 | ); 410 | defaultConfigurationIsVisible = 0; 411 | defaultConfigurationName = Release; 412 | }; 413 | /* End XCConfigurationList section */ 414 | }; 415 | rootObject = 68B6954F1DFA643F00D3BEA7 /* Project object */; 416 | } 417 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example 4 | // 5 | // Created by ebt on 2016/12/9. 6 | // Copyright © 2016年 ebt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Example/Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 32 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Example/Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Example/Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Example 4 | // 5 | // Created by ebt on 2016/12/9. 6 | // Copyright © 2016年 ebt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import RxUIAlertController 11 | import RxSwift 12 | import RxCocoa 13 | 14 | class ViewController: UIViewController { 15 | let disposeBag = DisposeBag() 16 | 17 | @IBAction func testAlert(_ sender: UIButton) { 18 | Alert(title: "Test", message: "This is a test message.") 19 | .addAction(title: "Yes") 20 | .addAction(title: "No", style: .destructive) 21 | .addTextField{ 22 | $0.placeholder = "placeholder" 23 | } 24 | .rx.show() 25 | .subscribe(onNext: { 26 | print("button: \($0.buttonTitle)") 27 | print($0.controller.textFields?.first?.text ?? "") 28 | }) 29 | .disposed(by: disposeBag) 30 | } 31 | 32 | @IBAction func testActionSheet(_ sender: UIButton) { 33 | ActionSheet(title: "Test", message: "This is a test message.") 34 | .addAction(title: "Yes") 35 | .addAction(title: "No", style: .destructive) 36 | .addAction(title: "Cancel", style: .cancel) 37 | .setPresenting(source: sender) 38 | .rx.show() 39 | .subscribe(onNext: { 40 | print("button: \($0.buttonTitle)") 41 | }) 42 | .disposed(by: disposeBag) 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'Example' do 4 | pod 'RxUIAlertController', :path => '../' 5 | end 6 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - RxCocoa (4.0.0): 3 | - RxSwift (~> 4.0) 4 | - RxSwift (4.0.0) 5 | - RxUIAlertController (1.1.0): 6 | - RxCocoa 7 | - RxSwift 8 | 9 | DEPENDENCIES: 10 | - RxUIAlertController (from `../`) 11 | 12 | EXTERNAL SOURCES: 13 | RxUIAlertController: 14 | :path: ../ 15 | 16 | SPEC CHECKSUMS: 17 | RxCocoa: d62846ca96495d862fa4c59ea7d87e5031d7340e 18 | RxSwift: fd680d75283beb5e2559486f3c0ff852f0d35334 19 | RxUIAlertController: d8f3c7683902ace299d22f59f0c60e77e8478a62 20 | 21 | PODFILE CHECKSUM: e001db0045e2931dc0163727851e37d20de11750 22 | 23 | COCOAPODS: 1.3.1 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RxUIAlertController 2 | 3 | [![CocoaPods](https://img.shields.io/cocoapods/v/RxUIAlertController.svg)](https://github.com/roshanman/RxUIAlertController) 4 | ![Swift 4](https://img.shields.io/badge/Swift-4.0.x-orange.svg) 5 | [![License](https://img.shields.io/cocoapods/l/RxSwift-Permission.svg?style=flat)](http://cocoapods.org/pods/RxUIAlertControllerssion) 6 | [![Platform](https://img.shields.io/cocoapods/p/RxSwift-Permission.svg?style=flat)](http://cocoapods.org/pods/RxUIAlertController) 7 | 8 | RxUIAlertController is a wrapper library to work with RxSwift and UIAlertController. 9 | 10 | 11 | 12 | ## Installation 13 | 14 | RxUIAlertController is available through [CocoaPods](http://cocoapods.org). 15 | 16 | 17 | ```ruby 18 | pod 'RxUIAlertController' 19 | ``` 20 | 21 | ### Sample code 22 | ```swift 23 | Alert(title: "Test", message: "This is a test message.") 24 | .addAction(title: "Yes") 25 | .addAction(title: "No", style: .destructive) 26 | .addTextField{ 27 | $0.placeholder = "placeholder" 28 | } 29 | .rx.show() 30 | .subscribe(onNext: { 31 | print("button: \($0.buttonTitle)") 32 | print($0.controller.textFields?.first?.text ?? "") 33 | }) 34 | .addDisposableTo(disposeBag) 35 | 36 | ActionSheet(title: "Test", message: "This is a test message.") 37 | .addAction(title: "Yes") 38 | .addAction(title: "No", style: .destructive) 39 | .addAction(title: "Cancel", style: .cancel) 40 | .setPresenting(source: sender) 41 | .rx.show() 42 | .subscribe(onNext: { 43 | print("button: \($0.buttonTitle)") 44 | }) 45 | .addDisposableTo(disposeBag) 46 | 47 | ``` 48 | 49 | ## Example 50 | 51 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 52 | 53 | ## License 54 | 55 | RxUIAlertController is available under the MIT license. See the LICENSE file for more info. 56 | -------------------------------------------------------------------------------- /RxUIAlertController.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "RxUIAlertController" 3 | s.version = "1.1.1" 4 | s.summary = "ReactiveX way to use UIAlertController on iOS." 5 | s.description = <<-EOS 6 | RxSwift binding for [Permission](https://github.com/delba/Permission) API that helps you with UIAlertController in iOS. 7 | EOS 8 | s.homepage = "https://github.com/roshanman/RxUIAlertController" 9 | s.license = 'MIT' 10 | s.author = { "roshanman" => "morenotepad@163.com" } 11 | s.source = { :git => "https://github.com/roshanman/RxUIAlertController.git", :tag => s.version.to_s } 12 | s.platform = :ios, '8.0' 13 | s.ios.deployment_target = '8.0' 14 | s.source_files = 'Source/*.swift' 15 | s.dependency 'RxSwift' 16 | s.dependency 'RxCocoa' 17 | end 18 | -------------------------------------------------------------------------------- /Source/RxAlertController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AlertController.swift 3 | // Togazer 4 | // 5 | // Created by roshanman on 16/9/14. 6 | // Copyright © 2016年 morenotepad. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import RxSwift 11 | import RxCocoa 12 | 13 | @available(iOS 8.0, *) 14 | public func Alert(title: String?, message: String?) -> AlertController { 15 | return AlertController(title: title, message: message, preferredStyle: .alert) 16 | } 17 | 18 | @available(iOS 8.0, *) 19 | public func ActionSheet(title: String?, message: String?) -> AlertController { 20 | return AlertController(title: title, message: message, preferredStyle: .actionSheet) 21 | } 22 | 23 | @available(iOS 8.0, *) 24 | public class AlertController: NSObject { 25 | 26 | public struct Result { 27 | public let buttonIndex: Int 28 | public let buttonTitle: String 29 | public let controller: UIAlertController 30 | 31 | init(alert: UIAlertController, buttonTitle: String, buttonIndex: Int) { 32 | self.buttonTitle = buttonTitle 33 | self.buttonIndex = buttonIndex 34 | controller = alert 35 | } 36 | } 37 | 38 | internal let alertController: UIAlertController 39 | internal var observer: AnyObserver? 40 | private var retainSelf: Any? 41 | private let disposeBag = DisposeBag() 42 | 43 | init(title: String?, message: String?, preferredStyle: UIAlertControllerStyle) { 44 | alertController = .init(title:title, message:message, preferredStyle:preferredStyle) 45 | 46 | super.init() 47 | 48 | alertController.rx.sentMessage(#selector(UIViewController.viewDidDisappear(_:))) 49 | .subscribe(onNext: { [weak self] _ in 50 | DispatchQueue.main.asyncAfter(deadline: .now() + DispatchTimeInterval.microseconds(300)) { 51 | self?.retainSelf = nil 52 | } 53 | }) 54 | .disposed(by: disposeBag) 55 | 56 | retainSelf = self 57 | } 58 | 59 | public func addAction(title: String, style: UIAlertActionStyle = .default, 60 | configure: ((UIAlertController, UIAlertAction) -> Void)? = nil) -> Self { 61 | let action = UIAlertAction(title: title, style: style) { [unowned self] action in 62 | 63 | let result = Result(alert: self.alertController, buttonTitle: title, 64 | buttonIndex: self.alertController.actions.index(of: action) ?? 0) 65 | 66 | self.observer?.onNext(result) 67 | self.observer?.onCompleted() 68 | } 69 | alertController.addAction(action) 70 | configure?(alertController, action) 71 | 72 | return self 73 | } 74 | 75 | @available(iOS 9.0, *) 76 | public func addPreferredAction(title: String, style: UIAlertActionStyle = .default, 77 | configure: ((UIAlertController, UIAlertAction) -> Void)? = nil) -> Self { 78 | return addAction(title: title, style: style) { alertController, action in 79 | alertController.preferredAction = action 80 | configure?(alertController, action) 81 | } 82 | } 83 | 84 | public func addTextField(configurationHandler: ((UITextField) -> Void)? = nil) -> Self { 85 | alertController.addTextField(configurationHandler: configurationHandler) 86 | 87 | return self 88 | } 89 | 90 | @discardableResult 91 | public func show(animated:Bool = true, completion: (() -> Void)? = nil) -> Self { 92 | if alertController.preferredStyle == .actionSheet && 93 | UIDevice.current.userInterfaceIdiom == .pad 94 | { 95 | if let popOver = alertController.popoverPresentationController { 96 | if popOver.sourceView == nil { 97 | if let topVC = self.topViewController { 98 | popOver.sourceView = topVC.view 99 | popOver.sourceRect = CGRect(x: topVC.view.bounds.midX, 100 | y: topVC.view.bounds.midY, 101 | width: 0, 102 | height: 0) 103 | 104 | popOver.permittedArrowDirections = [] 105 | } 106 | } 107 | } 108 | } 109 | 110 | self.presentedController?.present(self.alertController, 111 | animated: animated, 112 | completion: completion) 113 | 114 | return self 115 | } 116 | 117 | private var presentedController:UIViewController? { 118 | if let viewController = UIApplication.shared.keyWindow?.rootViewController { 119 | //Find the presented view controller 120 | var presentedController = viewController 121 | 122 | while presentedController.presentedViewController != nil && 123 | presentedController.presentedViewController?.isBeingDismissed == false 124 | { 125 | presentedController = presentedController.presentedViewController! 126 | } 127 | 128 | return presentedController 129 | } 130 | 131 | return nil 132 | } 133 | 134 | private var topViewController:UIViewController? { 135 | var topController = self.presentedController 136 | 137 | while topController?.childViewControllers.last != nil { 138 | topController = topController?.childViewControllers.last! 139 | } 140 | 141 | return topController 142 | } 143 | 144 | 145 | /// For ActionSheet 146 | public func setBarButton(item: UIBarButtonItem) -> Self { 147 | guard UIDevice.current.userInterfaceIdiom == .pad else { 148 | return self 149 | } 150 | 151 | if let popoverController = alertController.popoverPresentationController { 152 | popoverController.barButtonItem = item 153 | } 154 | 155 | return self 156 | } 157 | 158 | /// For ActionSheet 159 | public func setPresenting(source: UIView) -> Self { 160 | guard UIDevice.current.userInterfaceIdiom == .pad else { 161 | return self 162 | } 163 | 164 | if let popoverController = alertController.popoverPresentationController { 165 | popoverController.sourceView = source 166 | popoverController.sourceRect = source.bounds 167 | popoverController.permittedArrowDirections = [.any] 168 | } 169 | 170 | return self 171 | } 172 | 173 | deinit { 174 | //print("deinit") 175 | } 176 | } 177 | 178 | public extension Reactive where Base: AlertController { 179 | public func show(animated: Bool = true, completion: (() -> Void)? = nil) -> Observable { 180 | self.base.show(animated: animated, completion: completion) 181 | 182 | return Observable.create { observer in 183 | self.base.observer = observer 184 | 185 | return Disposables.create() 186 | } 187 | } 188 | } 189 | --------------------------------------------------------------------------------