├── .gitignore ├── AlertControllerCustomization.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── AlertControllerCustomization ├── Resources │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── image1.png │ ├── image2.png │ └── image3.png ├── Sources │ ├── AppDelegate.swift │ ├── SwitchAlertActionViewController.swift │ ├── SwitchAlertActionViewController.xib │ └── ViewController.swift ├── Supporting Files │ └── Info.plist └── UI │ └── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── LICENSE ├── README.md └── img ├── 1.png ├── 2.png ├── 3.png ├── 4.png └── 5.png /.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 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 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/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/screenshots 64 | -------------------------------------------------------------------------------- /AlertControllerCustomization.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6D9D60621C882C8D0036071B /* SwitchAlertActionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D9D60601C882C8D0036071B /* SwitchAlertActionViewController.swift */; }; 11 | 6D9D60631C882C8D0036071B /* SwitchAlertActionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6D9D60611C882C8D0036071B /* SwitchAlertActionViewController.xib */; }; 12 | 944BDD621C79B5A500C0DAB6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 944BDD571C79B5A500C0DAB6 /* Assets.xcassets */; }; 13 | 944BDD631C79B5A500C0DAB6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 944BDD591C79B5A500C0DAB6 /* AppDelegate.swift */; }; 14 | 944BDD641C79B5A500C0DAB6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 944BDD5A1C79B5A500C0DAB6 /* ViewController.swift */; }; 15 | 944BDD661C79B5A500C0DAB6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 944BDD5E1C79B5A500C0DAB6 /* LaunchScreen.storyboard */; }; 16 | 944BDD671C79B5A500C0DAB6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 944BDD601C79B5A500C0DAB6 /* Main.storyboard */; }; 17 | 944BDD6B1C79B63500C0DAB6 /* image1.png in Resources */ = {isa = PBXBuildFile; fileRef = 944BDD681C79B63500C0DAB6 /* image1.png */; }; 18 | 944BDD6C1C79B63500C0DAB6 /* image2.png in Resources */ = {isa = PBXBuildFile; fileRef = 944BDD691C79B63500C0DAB6 /* image2.png */; }; 19 | 944BDD6D1C79B63500C0DAB6 /* image3.png in Resources */ = {isa = PBXBuildFile; fileRef = 944BDD6A1C79B63500C0DAB6 /* image3.png */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 6D9D60601C882C8D0036071B /* SwitchAlertActionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwitchAlertActionViewController.swift; sourceTree = ""; }; 24 | 6D9D60611C882C8D0036071B /* SwitchAlertActionViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SwitchAlertActionViewController.xib; sourceTree = ""; }; 25 | 944BDD571C79B5A500C0DAB6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | 944BDD591C79B5A500C0DAB6 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 27 | 944BDD5A1C79B5A500C0DAB6 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 28 | 944BDD5C1C79B5A500C0DAB6 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 944BDD5F1C79B5A500C0DAB6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 944BDD611C79B5A500C0DAB6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 31 | 944BDD681C79B63500C0DAB6 /* image1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image1.png; sourceTree = ""; }; 32 | 944BDD691C79B63500C0DAB6 /* image2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image2.png; sourceTree = ""; }; 33 | 944BDD6A1C79B63500C0DAB6 /* image3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = image3.png; sourceTree = ""; }; 34 | 949318091C763EF10021384C /* AlertControllerCustomization.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AlertControllerCustomization.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 949318061C763EF10021384C /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | 944BDD561C79B5A500C0DAB6 /* Resources */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | 944BDD681C79B63500C0DAB6 /* image1.png */, 52 | 944BDD691C79B63500C0DAB6 /* image2.png */, 53 | 944BDD6A1C79B63500C0DAB6 /* image3.png */, 54 | 944BDD571C79B5A500C0DAB6 /* Assets.xcassets */, 55 | ); 56 | path = Resources; 57 | sourceTree = ""; 58 | }; 59 | 944BDD581C79B5A500C0DAB6 /* Sources */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 6D9D60601C882C8D0036071B /* SwitchAlertActionViewController.swift */, 63 | 6D9D60611C882C8D0036071B /* SwitchAlertActionViewController.xib */, 64 | 944BDD591C79B5A500C0DAB6 /* AppDelegate.swift */, 65 | 944BDD5A1C79B5A500C0DAB6 /* ViewController.swift */, 66 | ); 67 | path = Sources; 68 | sourceTree = ""; 69 | }; 70 | 944BDD5B1C79B5A500C0DAB6 /* Supporting Files */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 944BDD5C1C79B5A500C0DAB6 /* Info.plist */, 74 | ); 75 | path = "Supporting Files"; 76 | sourceTree = ""; 77 | }; 78 | 944BDD5D1C79B5A500C0DAB6 /* UI */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 944BDD5E1C79B5A500C0DAB6 /* LaunchScreen.storyboard */, 82 | 944BDD601C79B5A500C0DAB6 /* Main.storyboard */, 83 | ); 84 | path = UI; 85 | sourceTree = ""; 86 | }; 87 | 949318001C763EF10021384C = { 88 | isa = PBXGroup; 89 | children = ( 90 | 9493180B1C763EF10021384C /* AlertControllerCustomization */, 91 | 9493180A1C763EF10021384C /* Products */, 92 | ); 93 | sourceTree = ""; 94 | }; 95 | 9493180A1C763EF10021384C /* Products */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 949318091C763EF10021384C /* AlertControllerCustomization.app */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | 9493180B1C763EF10021384C /* AlertControllerCustomization */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 944BDD581C79B5A500C0DAB6 /* Sources */, 107 | 944BDD5D1C79B5A500C0DAB6 /* UI */, 108 | 944BDD561C79B5A500C0DAB6 /* Resources */, 109 | 944BDD5B1C79B5A500C0DAB6 /* Supporting Files */, 110 | ); 111 | path = AlertControllerCustomization; 112 | sourceTree = ""; 113 | }; 114 | /* End PBXGroup section */ 115 | 116 | /* Begin PBXNativeTarget section */ 117 | 949318081C763EF10021384C /* AlertControllerCustomization */ = { 118 | isa = PBXNativeTarget; 119 | buildConfigurationList = 9493181B1C763EF10021384C /* Build configuration list for PBXNativeTarget "AlertControllerCustomization" */; 120 | buildPhases = ( 121 | 949318051C763EF10021384C /* Sources */, 122 | 949318061C763EF10021384C /* Frameworks */, 123 | 949318071C763EF10021384C /* Resources */, 124 | ); 125 | buildRules = ( 126 | ); 127 | dependencies = ( 128 | ); 129 | name = AlertControllerCustomization; 130 | productName = AlertControllerCustomization; 131 | productReference = 949318091C763EF10021384C /* AlertControllerCustomization.app */; 132 | productType = "com.apple.product-type.application"; 133 | }; 134 | /* End PBXNativeTarget section */ 135 | 136 | /* Begin PBXProject section */ 137 | 949318011C763EF10021384C /* Project object */ = { 138 | isa = PBXProject; 139 | attributes = { 140 | LastSwiftUpdateCheck = 0720; 141 | LastUpgradeCheck = 1000; 142 | ORGANIZATIONNAME = "Maxim Bilan"; 143 | TargetAttributes = { 144 | 949318081C763EF10021384C = { 145 | CreatedOnToolsVersion = 7.2.1; 146 | LastSwiftMigration = 1000; 147 | }; 148 | }; 149 | }; 150 | buildConfigurationList = 949318041C763EF10021384C /* Build configuration list for PBXProject "AlertControllerCustomization" */; 151 | compatibilityVersion = "Xcode 3.2"; 152 | developmentRegion = English; 153 | hasScannedForEncodings = 0; 154 | knownRegions = ( 155 | en, 156 | Base, 157 | ); 158 | mainGroup = 949318001C763EF10021384C; 159 | productRefGroup = 9493180A1C763EF10021384C /* Products */; 160 | projectDirPath = ""; 161 | projectRoot = ""; 162 | targets = ( 163 | 949318081C763EF10021384C /* AlertControllerCustomization */, 164 | ); 165 | }; 166 | /* End PBXProject section */ 167 | 168 | /* Begin PBXResourcesBuildPhase section */ 169 | 949318071C763EF10021384C /* Resources */ = { 170 | isa = PBXResourcesBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | 6D9D60631C882C8D0036071B /* SwitchAlertActionViewController.xib in Resources */, 174 | 944BDD661C79B5A500C0DAB6 /* LaunchScreen.storyboard in Resources */, 175 | 944BDD6D1C79B63500C0DAB6 /* image3.png in Resources */, 176 | 944BDD6C1C79B63500C0DAB6 /* image2.png in Resources */, 177 | 944BDD6B1C79B63500C0DAB6 /* image1.png in Resources */, 178 | 944BDD621C79B5A500C0DAB6 /* Assets.xcassets in Resources */, 179 | 944BDD671C79B5A500C0DAB6 /* Main.storyboard in Resources */, 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | }; 183 | /* End PBXResourcesBuildPhase section */ 184 | 185 | /* Begin PBXSourcesBuildPhase section */ 186 | 949318051C763EF10021384C /* Sources */ = { 187 | isa = PBXSourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 6D9D60621C882C8D0036071B /* SwitchAlertActionViewController.swift in Sources */, 191 | 944BDD641C79B5A500C0DAB6 /* ViewController.swift in Sources */, 192 | 944BDD631C79B5A500C0DAB6 /* AppDelegate.swift in Sources */, 193 | ); 194 | runOnlyForDeploymentPostprocessing = 0; 195 | }; 196 | /* End PBXSourcesBuildPhase section */ 197 | 198 | /* Begin PBXVariantGroup section */ 199 | 944BDD5E1C79B5A500C0DAB6 /* LaunchScreen.storyboard */ = { 200 | isa = PBXVariantGroup; 201 | children = ( 202 | 944BDD5F1C79B5A500C0DAB6 /* Base */, 203 | ); 204 | name = LaunchScreen.storyboard; 205 | sourceTree = ""; 206 | }; 207 | 944BDD601C79B5A500C0DAB6 /* Main.storyboard */ = { 208 | isa = PBXVariantGroup; 209 | children = ( 210 | 944BDD611C79B5A500C0DAB6 /* Base */, 211 | ); 212 | name = Main.storyboard; 213 | sourceTree = ""; 214 | }; 215 | /* End PBXVariantGroup section */ 216 | 217 | /* Begin XCBuildConfiguration section */ 218 | 949318191C763EF10021384C /* Debug */ = { 219 | isa = XCBuildConfiguration; 220 | buildSettings = { 221 | ALWAYS_SEARCH_USER_PATHS = NO; 222 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 223 | CLANG_CXX_LIBRARY = "libc++"; 224 | CLANG_ENABLE_MODULES = YES; 225 | CLANG_ENABLE_OBJC_ARC = YES; 226 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 227 | CLANG_WARN_BOOL_CONVERSION = YES; 228 | CLANG_WARN_COMMA = YES; 229 | CLANG_WARN_CONSTANT_CONVERSION = YES; 230 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 231 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 232 | CLANG_WARN_EMPTY_BODY = YES; 233 | CLANG_WARN_ENUM_CONVERSION = YES; 234 | CLANG_WARN_INFINITE_RECURSION = YES; 235 | CLANG_WARN_INT_CONVERSION = YES; 236 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 237 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 238 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 239 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 240 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 241 | CLANG_WARN_STRICT_PROTOTYPES = YES; 242 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 243 | CLANG_WARN_UNREACHABLE_CODE = YES; 244 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 245 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 246 | COPY_PHASE_STRIP = NO; 247 | DEBUG_INFORMATION_FORMAT = dwarf; 248 | ENABLE_STRICT_OBJC_MSGSEND = YES; 249 | ENABLE_TESTABILITY = YES; 250 | GCC_C_LANGUAGE_STANDARD = gnu99; 251 | GCC_DYNAMIC_NO_PIC = NO; 252 | GCC_NO_COMMON_BLOCKS = YES; 253 | GCC_OPTIMIZATION_LEVEL = 0; 254 | GCC_PREPROCESSOR_DEFINITIONS = ( 255 | "DEBUG=1", 256 | "$(inherited)", 257 | ); 258 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 259 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 260 | GCC_WARN_UNDECLARED_SELECTOR = YES; 261 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 262 | GCC_WARN_UNUSED_FUNCTION = YES; 263 | GCC_WARN_UNUSED_VARIABLE = YES; 264 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 265 | MTL_ENABLE_DEBUG_INFO = YES; 266 | ONLY_ACTIVE_ARCH = YES; 267 | SDKROOT = iphoneos; 268 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 269 | TARGETED_DEVICE_FAMILY = "1,2"; 270 | }; 271 | name = Debug; 272 | }; 273 | 9493181A1C763EF10021384C /* Release */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | ALWAYS_SEARCH_USER_PATHS = NO; 277 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 278 | CLANG_CXX_LIBRARY = "libc++"; 279 | CLANG_ENABLE_MODULES = YES; 280 | CLANG_ENABLE_OBJC_ARC = YES; 281 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 282 | CLANG_WARN_BOOL_CONVERSION = YES; 283 | CLANG_WARN_COMMA = YES; 284 | CLANG_WARN_CONSTANT_CONVERSION = YES; 285 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 286 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 287 | CLANG_WARN_EMPTY_BODY = YES; 288 | CLANG_WARN_ENUM_CONVERSION = YES; 289 | CLANG_WARN_INFINITE_RECURSION = YES; 290 | CLANG_WARN_INT_CONVERSION = YES; 291 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 292 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 293 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 296 | CLANG_WARN_STRICT_PROTOTYPES = YES; 297 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 298 | CLANG_WARN_UNREACHABLE_CODE = YES; 299 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 300 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 301 | COPY_PHASE_STRIP = NO; 302 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 303 | ENABLE_NS_ASSERTIONS = NO; 304 | ENABLE_STRICT_OBJC_MSGSEND = YES; 305 | GCC_C_LANGUAGE_STANDARD = gnu99; 306 | GCC_NO_COMMON_BLOCKS = YES; 307 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 308 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 309 | GCC_WARN_UNDECLARED_SELECTOR = YES; 310 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 311 | GCC_WARN_UNUSED_FUNCTION = YES; 312 | GCC_WARN_UNUSED_VARIABLE = YES; 313 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 314 | MTL_ENABLE_DEBUG_INFO = NO; 315 | SDKROOT = iphoneos; 316 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 317 | TARGETED_DEVICE_FAMILY = "1,2"; 318 | VALIDATE_PRODUCT = YES; 319 | }; 320 | name = Release; 321 | }; 322 | 9493181C1C763EF10021384C /* Debug */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 326 | INFOPLIST_FILE = "$(SRCROOT)/AlertControllerCustomization/Supporting Files/Info.plist"; 327 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 328 | PRODUCT_BUNDLE_IDENTIFIER = com.maximbilan.AlertControllerCustomization; 329 | PRODUCT_NAME = "$(TARGET_NAME)"; 330 | SWIFT_VERSION = 4.2; 331 | }; 332 | name = Debug; 333 | }; 334 | 9493181D1C763EF10021384C /* Release */ = { 335 | isa = XCBuildConfiguration; 336 | buildSettings = { 337 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 338 | INFOPLIST_FILE = "$(SRCROOT)/AlertControllerCustomization/Supporting Files/Info.plist"; 339 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 340 | PRODUCT_BUNDLE_IDENTIFIER = com.maximbilan.AlertControllerCustomization; 341 | PRODUCT_NAME = "$(TARGET_NAME)"; 342 | SWIFT_VERSION = 4.2; 343 | }; 344 | name = Release; 345 | }; 346 | /* End XCBuildConfiguration section */ 347 | 348 | /* Begin XCConfigurationList section */ 349 | 949318041C763EF10021384C /* Build configuration list for PBXProject "AlertControllerCustomization" */ = { 350 | isa = XCConfigurationList; 351 | buildConfigurations = ( 352 | 949318191C763EF10021384C /* Debug */, 353 | 9493181A1C763EF10021384C /* Release */, 354 | ); 355 | defaultConfigurationIsVisible = 0; 356 | defaultConfigurationName = Release; 357 | }; 358 | 9493181B1C763EF10021384C /* Build configuration list for PBXNativeTarget "AlertControllerCustomization" */ = { 359 | isa = XCConfigurationList; 360 | buildConfigurations = ( 361 | 9493181C1C763EF10021384C /* Debug */, 362 | 9493181D1C763EF10021384C /* Release */, 363 | ); 364 | defaultConfigurationIsVisible = 0; 365 | defaultConfigurationName = Release; 366 | }; 367 | /* End XCConfigurationList section */ 368 | }; 369 | rootObject = 949318011C763EF10021384C /* Project object */; 370 | } 371 | -------------------------------------------------------------------------------- /AlertControllerCustomization.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AlertControllerCustomization.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AlertControllerCustomization/Resources/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "83.5x83.5", 66 | "scale" : "2x" 67 | } 68 | ], 69 | "info" : { 70 | "version" : 1, 71 | "author" : "xcode" 72 | } 73 | } -------------------------------------------------------------------------------- /AlertControllerCustomization/Resources/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/UIAlertController-Customization/90feec30306ee636ba2e9870926678feb5c0a8f3/AlertControllerCustomization/Resources/image1.png -------------------------------------------------------------------------------- /AlertControllerCustomization/Resources/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/UIAlertController-Customization/90feec30306ee636ba2e9870926678feb5c0a8f3/AlertControllerCustomization/Resources/image2.png -------------------------------------------------------------------------------- /AlertControllerCustomization/Resources/image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/UIAlertController-Customization/90feec30306ee636ba2e9870926678feb5c0a8f3/AlertControllerCustomization/Resources/image3.png -------------------------------------------------------------------------------- /AlertControllerCustomization/Sources/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // AlertControllerCustomization 4 | // 5 | // Created by Maxim on 2/18/16. 6 | // Copyright © 2016 Maxim Bilan. 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: [UIApplication.LaunchOptionsKey: 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 throttle down OpenGL ES frame rates. 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 inactive 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 | -------------------------------------------------------------------------------- /AlertControllerCustomization/Sources/SwitchAlertActionViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwitchAlertActionViewController.swift 3 | // Bitsboard-Telling Time 4 | // 5 | // Created by Maxim Bilan on 2/16/16. 6 | // 7 | // 8 | 9 | import UIKit 10 | 11 | class SwitchAlertActionViewController: UIViewController { 12 | 13 | @IBOutlet weak var valueSwitch: UISwitch! 14 | var isSwitchOn = false 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | valueSwitch.isOn = isSwitchOn 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /AlertControllerCustomization/Sources/SwitchAlertActionViewController.xib: -------------------------------------------------------------------------------- 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 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /AlertControllerCustomization/Sources/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // AlertControllerCustomization 4 | // 5 | // Created by Maxim on 2/18/16. 6 | // Copyright © 2016 Maxim Bilan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | let rightBarButton = UIBarButtonItem(title: "Press", style: UIBarButtonItem.Style.done, target: self, action: #selector(ViewController.pressAction)) 17 | self.navigationItem.rightBarButtonItem = rightBarButton 18 | } 19 | 20 | @objc func pressAction() { 21 | let alertController = UIAlertController(title: "Title", message: "Message", preferredStyle: UIAlertController.Style.actionSheet) 22 | 23 | let alertAction1 = UIAlertAction(title: "One", style: UIAlertAction.Style.default, handler: nil) 24 | let alertAction2 = UIAlertAction(title: "Two", style: UIAlertAction.Style.default, handler: nil) 25 | let alertAction3 = UIAlertAction(title: "Three", style: UIAlertAction.Style.default, handler: nil) 26 | let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertAction.Style.cancel, handler: nil) 27 | 28 | alertAction1.setValue(UIImage(named: "image1.png")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), forKey: "image") 29 | alertAction3.setValue(UIImage(named: "image3.png")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), forKey: "image") 30 | 31 | let switchAlert = SwitchAlertActionViewController() 32 | switchAlert.isSwitchOn = true 33 | alertAction2.setValue(switchAlert, forKey: "contentViewController") 34 | 35 | alertController.addAction(alertAction1) 36 | alertController.addAction(alertAction2) 37 | alertController.addAction(alertAction3) 38 | alertController.addAction(cancelAction) 39 | 40 | let popPresenter = alertController.popoverPresentationController 41 | popPresenter?.sourceView = self.view 42 | popPresenter?.barButtonItem = self.navigationItem.rightBarButtonItem 43 | self.present(alertController, animated: true, completion: nil) 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /AlertControllerCustomization/Supporting Files/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 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /AlertControllerCustomization/UI/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 | 29 | -------------------------------------------------------------------------------- /AlertControllerCustomization/UI/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 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Maxim Bilan 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 | # Customization of UIAlertController 2 | 3 | Recently I’m faced with an unusual task using UIAlertController. First, add an image to some of items. And the second, add UISwitch control. 4 | 5 | ![alt tag](https://raw.github.com/maximbilan/UIAlertController-Customization/master/img/1.png) 6 | 7 | I know it doesn’t matсh Apple design flow, but maybe someone will come in handy for resolving different tasks. 8 | 9 | The first, how to add an image. UIAlertController or UIAlertAction has not public methods for this, but you can do this via setValue for key ‘image’. For example: 10 | 11 |
12 | alertAction.setValue(UIImage(named: "image1.png"), forKey: "image")
13 | 
14 | 15 | But you will get no good result. 16 | 17 | ![alt tag](https://raw.github.com/maximbilan/UIAlertController-Customization/master/img/2.png) 18 | 19 | Please create a version of this image with the specified rendering mode. In our case with AlwaysOriginal. 20 | 21 |
22 | alertAction.setValue(UIImage(named: "image1.png")?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), forKey: "image")
23 | 
24 | 25 | And see what we will get: 26 | 27 | ![alt tag](https://raw.github.com/maximbilan/UIAlertController-Customization/master/img/3.png) 28 | 29 | The second thing, how to add a switch control?  30 | 31 | Let’s create a new view controller and a user interface for this. 32 | 33 | ![alt tag](https://raw.github.com/maximbilan/UIAlertController-Customization/master/img/4.png) 34 | 35 |
36 | import UIKit
37 | 
38 | class SwitchAlertActionViewController: UIViewController {
39 |   @IBOutlet weak var valueSwitch: UISwitch!
40 |   var isSwitchOn = false
41 |  
42 |   override func viewDidLoad() {
43 |     super.viewDidLoad()
44 | 
45 |     valueSwitch.on = isSwitchOn
46 |   }
47 | }
48 | 
49 | 50 | And the last point, we need to apply this controller to UIAlertAction. The same way using a key contentViewController. 51 | 52 |
53 | let switchAlert = SwitchAlertActionViewController()
54 | switchAlert.isSwitchOn = true
55 | alertAction.setValue(switchAlert, forKey: "contentViewController")
56 | 
57 | 58 | ![alt tag](https://raw.github.com/maximbilan/UIAlertController-Customization/master/img/5.png) 59 | -------------------------------------------------------------------------------- /img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/UIAlertController-Customization/90feec30306ee636ba2e9870926678feb5c0a8f3/img/1.png -------------------------------------------------------------------------------- /img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/UIAlertController-Customization/90feec30306ee636ba2e9870926678feb5c0a8f3/img/2.png -------------------------------------------------------------------------------- /img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/UIAlertController-Customization/90feec30306ee636ba2e9870926678feb5c0a8f3/img/3.png -------------------------------------------------------------------------------- /img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/UIAlertController-Customization/90feec30306ee636ba2e9870926678feb5c0a8f3/img/4.png -------------------------------------------------------------------------------- /img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maximbilan/UIAlertController-Customization/90feec30306ee636ba2e9870926678feb5c0a8f3/img/5.png --------------------------------------------------------------------------------