├── Example ├── LLNetworkAccessibility-Swift.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── LLNetworkAccessibility-Swift-Example.xcscheme ├── LLNetworkAccessibility-Swift │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── ViewController.swift ├── Podfile └── Tests │ ├── Info.plist │ └── Tests.swift ├── LICENSE ├── LLNetworkAccessibility-Swift.podspec ├── LLNetworkAccessibility-Swift ├── Assets │ └── .gitkeep ├── Classes │ ├── .gitkeep │ ├── LLAccessibilityAlertController.swift │ └── LLNetworkAccessibility.swift └── LLNetworkAccessibility.bundle │ ├── LLAccessibilityImage1.png │ └── LLAccessibilityImage2.png ├── README.md └── _Pods.xcodeproj /Example/LLNetworkAccessibility-Swift.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 11 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; 12 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; 13 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 14 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 15 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; 16 | 915D968A7186AB68D1F70386 /* Pods_LLNetworkAccessibility_Swift_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 361EE5A0A8F26BAA40DB4960 /* Pods_LLNetworkAccessibility_Swift_Example.framework */; }; 17 | FD74EA9F14710951EE72A37D /* Pods_LLNetworkAccessibility_Swift_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A45E0259DB0F55B6F89DE202 /* Pods_LLNetworkAccessibility_Swift_Tests.framework */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 607FACC81AFB9204008FA782 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 607FACCF1AFB9204008FA782; 26 | remoteInfo = "LLNetworkAccessibility-Swift"; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 00477BF6F20D7EB82F4749E8 /* Pods-LLNetworkAccessibility-Swift_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LLNetworkAccessibility-Swift_Example.release.xcconfig"; path = "Target Support Files/Pods-LLNetworkAccessibility-Swift_Example/Pods-LLNetworkAccessibility-Swift_Example.release.xcconfig"; sourceTree = ""; }; 32 | 361EE5A0A8F26BAA40DB4960 /* Pods_LLNetworkAccessibility_Swift_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LLNetworkAccessibility_Swift_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | 607FACD01AFB9204008FA782 /* LLNetworkAccessibility-Swift_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "LLNetworkAccessibility-Swift_Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 36 | 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 37 | 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 38 | 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 39 | 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 40 | 607FACE51AFB9204008FA782 /* LLNetworkAccessibility-Swift_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "LLNetworkAccessibility-Swift_Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 43 | A2F0350558C9375626D28864 /* Pods-LLNetworkAccessibility-Swift_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LLNetworkAccessibility-Swift_Tests.debug.xcconfig"; path = "Target Support Files/Pods-LLNetworkAccessibility-Swift_Tests/Pods-LLNetworkAccessibility-Swift_Tests.debug.xcconfig"; sourceTree = ""; }; 44 | A45E0259DB0F55B6F89DE202 /* Pods_LLNetworkAccessibility_Swift_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LLNetworkAccessibility_Swift_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | A9714EDE5437661E9C901B2F /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 46 | BC9DA9F76D9D519A012FD8C9 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 47 | ECB0965A0704F65C1B3E44F3 /* LLNetworkAccessibility-Swift.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = "LLNetworkAccessibility-Swift.podspec"; path = "../LLNetworkAccessibility-Swift.podspec"; sourceTree = ""; }; 48 | EF213068310C0656F2567760 /* Pods-LLNetworkAccessibility-Swift_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LLNetworkAccessibility-Swift_Example.debug.xcconfig"; path = "Target Support Files/Pods-LLNetworkAccessibility-Swift_Example/Pods-LLNetworkAccessibility-Swift_Example.debug.xcconfig"; sourceTree = ""; }; 49 | F3D8A64C96B1A553889E287A /* Pods-LLNetworkAccessibility-Swift_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LLNetworkAccessibility-Swift_Tests.release.xcconfig"; path = "Target Support Files/Pods-LLNetworkAccessibility-Swift_Tests/Pods-LLNetworkAccessibility-Swift_Tests.release.xcconfig"; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 607FACCD1AFB9204008FA782 /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | 915D968A7186AB68D1F70386 /* Pods_LLNetworkAccessibility_Swift_Example.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | 607FACE21AFB9204008FA782 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | FD74EA9F14710951EE72A37D /* Pods_LLNetworkAccessibility_Swift_Tests.framework in Frameworks */, 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | /* End PBXFrameworksBuildPhase section */ 70 | 71 | /* Begin PBXGroup section */ 72 | 5A6347E776E2D58365BC013F /* Frameworks */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 361EE5A0A8F26BAA40DB4960 /* Pods_LLNetworkAccessibility_Swift_Example.framework */, 76 | A45E0259DB0F55B6F89DE202 /* Pods_LLNetworkAccessibility_Swift_Tests.framework */, 77 | ); 78 | name = Frameworks; 79 | sourceTree = ""; 80 | }; 81 | 607FACC71AFB9204008FA782 = { 82 | isa = PBXGroup; 83 | children = ( 84 | 607FACF51AFB993E008FA782 /* Podspec Metadata */, 85 | 607FACD21AFB9204008FA782 /* Example for LLNetworkAccessibility-Swift */, 86 | 607FACE81AFB9204008FA782 /* Tests */, 87 | 607FACD11AFB9204008FA782 /* Products */, 88 | 8264451FE4B847921BA59C49 /* Pods */, 89 | 5A6347E776E2D58365BC013F /* Frameworks */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 607FACD11AFB9204008FA782 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 607FACD01AFB9204008FA782 /* LLNetworkAccessibility-Swift_Example.app */, 97 | 607FACE51AFB9204008FA782 /* LLNetworkAccessibility-Swift_Tests.xctest */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 607FACD21AFB9204008FA782 /* Example for LLNetworkAccessibility-Swift */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */, 106 | 607FACD71AFB9204008FA782 /* ViewController.swift */, 107 | 607FACD91AFB9204008FA782 /* Main.storyboard */, 108 | 607FACDC1AFB9204008FA782 /* Images.xcassets */, 109 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, 110 | 607FACD31AFB9204008FA782 /* Supporting Files */, 111 | ); 112 | name = "Example for LLNetworkAccessibility-Swift"; 113 | path = "LLNetworkAccessibility-Swift"; 114 | sourceTree = ""; 115 | }; 116 | 607FACD31AFB9204008FA782 /* Supporting Files */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 607FACD41AFB9204008FA782 /* Info.plist */, 120 | ); 121 | name = "Supporting Files"; 122 | sourceTree = ""; 123 | }; 124 | 607FACE81AFB9204008FA782 /* Tests */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 607FACEB1AFB9204008FA782 /* Tests.swift */, 128 | 607FACE91AFB9204008FA782 /* Supporting Files */, 129 | ); 130 | path = Tests; 131 | sourceTree = ""; 132 | }; 133 | 607FACE91AFB9204008FA782 /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 607FACEA1AFB9204008FA782 /* Info.plist */, 137 | ); 138 | name = "Supporting Files"; 139 | sourceTree = ""; 140 | }; 141 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | ECB0965A0704F65C1B3E44F3 /* LLNetworkAccessibility-Swift.podspec */, 145 | A9714EDE5437661E9C901B2F /* README.md */, 146 | BC9DA9F76D9D519A012FD8C9 /* LICENSE */, 147 | ); 148 | name = "Podspec Metadata"; 149 | sourceTree = ""; 150 | }; 151 | 8264451FE4B847921BA59C49 /* Pods */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | EF213068310C0656F2567760 /* Pods-LLNetworkAccessibility-Swift_Example.debug.xcconfig */, 155 | 00477BF6F20D7EB82F4749E8 /* Pods-LLNetworkAccessibility-Swift_Example.release.xcconfig */, 156 | A2F0350558C9375626D28864 /* Pods-LLNetworkAccessibility-Swift_Tests.debug.xcconfig */, 157 | F3D8A64C96B1A553889E287A /* Pods-LLNetworkAccessibility-Swift_Tests.release.xcconfig */, 158 | ); 159 | path = Pods; 160 | sourceTree = ""; 161 | }; 162 | /* End PBXGroup section */ 163 | 164 | /* Begin PBXNativeTarget section */ 165 | 607FACCF1AFB9204008FA782 /* LLNetworkAccessibility-Swift_Example */ = { 166 | isa = PBXNativeTarget; 167 | buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "LLNetworkAccessibility-Swift_Example" */; 168 | buildPhases = ( 169 | 0DE3D921116093E947F272AA /* [CP] Check Pods Manifest.lock */, 170 | 607FACCC1AFB9204008FA782 /* Sources */, 171 | 607FACCD1AFB9204008FA782 /* Frameworks */, 172 | 607FACCE1AFB9204008FA782 /* Resources */, 173 | 061B084BBC99807DF45679E2 /* [CP] Embed Pods Frameworks */, 174 | ); 175 | buildRules = ( 176 | ); 177 | dependencies = ( 178 | ); 179 | name = "LLNetworkAccessibility-Swift_Example"; 180 | productName = "LLNetworkAccessibility-Swift"; 181 | productReference = 607FACD01AFB9204008FA782 /* LLNetworkAccessibility-Swift_Example.app */; 182 | productType = "com.apple.product-type.application"; 183 | }; 184 | 607FACE41AFB9204008FA782 /* LLNetworkAccessibility-Swift_Tests */ = { 185 | isa = PBXNativeTarget; 186 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "LLNetworkAccessibility-Swift_Tests" */; 187 | buildPhases = ( 188 | A090FC7723508F0CE3659C48 /* [CP] Check Pods Manifest.lock */, 189 | 607FACE11AFB9204008FA782 /* Sources */, 190 | 607FACE21AFB9204008FA782 /* Frameworks */, 191 | 607FACE31AFB9204008FA782 /* Resources */, 192 | ); 193 | buildRules = ( 194 | ); 195 | dependencies = ( 196 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */, 197 | ); 198 | name = "LLNetworkAccessibility-Swift_Tests"; 199 | productName = Tests; 200 | productReference = 607FACE51AFB9204008FA782 /* LLNetworkAccessibility-Swift_Tests.xctest */; 201 | productType = "com.apple.product-type.bundle.unit-test"; 202 | }; 203 | /* End PBXNativeTarget section */ 204 | 205 | /* Begin PBXProject section */ 206 | 607FACC81AFB9204008FA782 /* Project object */ = { 207 | isa = PBXProject; 208 | attributes = { 209 | LastSwiftUpdateCheck = 0830; 210 | LastUpgradeCheck = 0830; 211 | ORGANIZATIONNAME = CocoaPods; 212 | TargetAttributes = { 213 | 607FACCF1AFB9204008FA782 = { 214 | CreatedOnToolsVersion = 6.3.1; 215 | DevelopmentTeam = P434QUZTFY; 216 | LastSwiftMigration = 0900; 217 | }; 218 | 607FACE41AFB9204008FA782 = { 219 | CreatedOnToolsVersion = 6.3.1; 220 | DevelopmentTeam = P434QUZTFY; 221 | LastSwiftMigration = 0900; 222 | TestTargetID = 607FACCF1AFB9204008FA782; 223 | }; 224 | }; 225 | }; 226 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "LLNetworkAccessibility-Swift" */; 227 | compatibilityVersion = "Xcode 3.2"; 228 | developmentRegion = English; 229 | hasScannedForEncodings = 0; 230 | knownRegions = ( 231 | English, 232 | en, 233 | Base, 234 | ); 235 | mainGroup = 607FACC71AFB9204008FA782; 236 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */; 237 | projectDirPath = ""; 238 | projectRoot = ""; 239 | targets = ( 240 | 607FACCF1AFB9204008FA782 /* LLNetworkAccessibility-Swift_Example */, 241 | 607FACE41AFB9204008FA782 /* LLNetworkAccessibility-Swift_Tests */, 242 | ); 243 | }; 244 | /* End PBXProject section */ 245 | 246 | /* Begin PBXResourcesBuildPhase section */ 247 | 607FACCE1AFB9204008FA782 /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, 252 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, 253 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | 607FACE31AFB9204008FA782 /* Resources */ = { 258 | isa = PBXResourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | /* End PBXResourcesBuildPhase section */ 265 | 266 | /* Begin PBXShellScriptBuildPhase section */ 267 | 061B084BBC99807DF45679E2 /* [CP] Embed Pods Frameworks */ = { 268 | isa = PBXShellScriptBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | ); 272 | inputPaths = ( 273 | "${PODS_ROOT}/Target Support Files/Pods-LLNetworkAccessibility-Swift_Example/Pods-LLNetworkAccessibility-Swift_Example-frameworks.sh", 274 | "${BUILT_PRODUCTS_DIR}/LLNetworkAccessibility-Swift/LLNetworkAccessibility_Swift.framework", 275 | ); 276 | name = "[CP] Embed Pods Frameworks"; 277 | outputPaths = ( 278 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LLNetworkAccessibility_Swift.framework", 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | shellPath = /bin/sh; 282 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-LLNetworkAccessibility-Swift_Example/Pods-LLNetworkAccessibility-Swift_Example-frameworks.sh\"\n"; 283 | showEnvVarsInLog = 0; 284 | }; 285 | 0DE3D921116093E947F272AA /* [CP] Check Pods Manifest.lock */ = { 286 | isa = PBXShellScriptBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | ); 290 | inputFileListPaths = ( 291 | ); 292 | inputPaths = ( 293 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 294 | "${PODS_ROOT}/Manifest.lock", 295 | ); 296 | name = "[CP] Check Pods Manifest.lock"; 297 | outputFileListPaths = ( 298 | ); 299 | outputPaths = ( 300 | "$(DERIVED_FILE_DIR)/Pods-LLNetworkAccessibility-Swift_Example-checkManifestLockResult.txt", 301 | ); 302 | runOnlyForDeploymentPostprocessing = 0; 303 | shellPath = /bin/sh; 304 | 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"; 305 | showEnvVarsInLog = 0; 306 | }; 307 | A090FC7723508F0CE3659C48 /* [CP] Check Pods Manifest.lock */ = { 308 | isa = PBXShellScriptBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | ); 312 | inputFileListPaths = ( 313 | ); 314 | inputPaths = ( 315 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 316 | "${PODS_ROOT}/Manifest.lock", 317 | ); 318 | name = "[CP] Check Pods Manifest.lock"; 319 | outputFileListPaths = ( 320 | ); 321 | outputPaths = ( 322 | "$(DERIVED_FILE_DIR)/Pods-LLNetworkAccessibility-Swift_Tests-checkManifestLockResult.txt", 323 | ); 324 | runOnlyForDeploymentPostprocessing = 0; 325 | shellPath = /bin/sh; 326 | 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"; 327 | showEnvVarsInLog = 0; 328 | }; 329 | /* End PBXShellScriptBuildPhase section */ 330 | 331 | /* Begin PBXSourcesBuildPhase section */ 332 | 607FACCC1AFB9204008FA782 /* Sources */ = { 333 | isa = PBXSourcesBuildPhase; 334 | buildActionMask = 2147483647; 335 | files = ( 336 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */, 337 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, 338 | ); 339 | runOnlyForDeploymentPostprocessing = 0; 340 | }; 341 | 607FACE11AFB9204008FA782 /* Sources */ = { 342 | isa = PBXSourcesBuildPhase; 343 | buildActionMask = 2147483647; 344 | files = ( 345 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, 346 | ); 347 | runOnlyForDeploymentPostprocessing = 0; 348 | }; 349 | /* End PBXSourcesBuildPhase section */ 350 | 351 | /* Begin PBXTargetDependency section */ 352 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = { 353 | isa = PBXTargetDependency; 354 | target = 607FACCF1AFB9204008FA782 /* LLNetworkAccessibility-Swift_Example */; 355 | targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */; 356 | }; 357 | /* End PBXTargetDependency section */ 358 | 359 | /* Begin PBXVariantGroup section */ 360 | 607FACD91AFB9204008FA782 /* Main.storyboard */ = { 361 | isa = PBXVariantGroup; 362 | children = ( 363 | 607FACDA1AFB9204008FA782 /* Base */, 364 | ); 365 | name = Main.storyboard; 366 | sourceTree = ""; 367 | }; 368 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { 369 | isa = PBXVariantGroup; 370 | children = ( 371 | 607FACDF1AFB9204008FA782 /* Base */, 372 | ); 373 | name = LaunchScreen.xib; 374 | sourceTree = ""; 375 | }; 376 | /* End PBXVariantGroup section */ 377 | 378 | /* Begin XCBuildConfiguration section */ 379 | 607FACED1AFB9204008FA782 /* Debug */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | ALWAYS_SEARCH_USER_PATHS = NO; 383 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 384 | CLANG_CXX_LIBRARY = "libc++"; 385 | CLANG_ENABLE_MODULES = YES; 386 | CLANG_ENABLE_OBJC_ARC = YES; 387 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 388 | CLANG_WARN_BOOL_CONVERSION = YES; 389 | CLANG_WARN_COMMA = YES; 390 | CLANG_WARN_CONSTANT_CONVERSION = YES; 391 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 392 | CLANG_WARN_EMPTY_BODY = YES; 393 | CLANG_WARN_ENUM_CONVERSION = YES; 394 | CLANG_WARN_INFINITE_RECURSION = YES; 395 | CLANG_WARN_INT_CONVERSION = YES; 396 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 397 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 399 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 400 | CLANG_WARN_STRICT_PROTOTYPES = YES; 401 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 407 | ENABLE_STRICT_OBJC_MSGSEND = YES; 408 | ENABLE_TESTABILITY = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_DYNAMIC_NO_PIC = NO; 411 | GCC_NO_COMMON_BLOCKS = YES; 412 | GCC_OPTIMIZATION_LEVEL = 0; 413 | GCC_PREPROCESSOR_DEFINITIONS = ( 414 | "DEBUG=1", 415 | "$(inherited)", 416 | ); 417 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 418 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 419 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 420 | GCC_WARN_UNDECLARED_SELECTOR = YES; 421 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 422 | GCC_WARN_UNUSED_FUNCTION = YES; 423 | GCC_WARN_UNUSED_VARIABLE = YES; 424 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 425 | MTL_ENABLE_DEBUG_INFO = YES; 426 | ONLY_ACTIVE_ARCH = YES; 427 | SDKROOT = iphoneos; 428 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 429 | }; 430 | name = Debug; 431 | }; 432 | 607FACEE1AFB9204008FA782 /* Release */ = { 433 | isa = XCBuildConfiguration; 434 | buildSettings = { 435 | ALWAYS_SEARCH_USER_PATHS = NO; 436 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 437 | CLANG_CXX_LIBRARY = "libc++"; 438 | CLANG_ENABLE_MODULES = YES; 439 | CLANG_ENABLE_OBJC_ARC = YES; 440 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 441 | CLANG_WARN_BOOL_CONVERSION = YES; 442 | CLANG_WARN_COMMA = YES; 443 | CLANG_WARN_CONSTANT_CONVERSION = YES; 444 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 445 | CLANG_WARN_EMPTY_BODY = YES; 446 | CLANG_WARN_ENUM_CONVERSION = YES; 447 | CLANG_WARN_INFINITE_RECURSION = YES; 448 | CLANG_WARN_INT_CONVERSION = YES; 449 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 450 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 451 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 452 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 453 | CLANG_WARN_STRICT_PROTOTYPES = YES; 454 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 455 | CLANG_WARN_UNREACHABLE_CODE = YES; 456 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 457 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 458 | COPY_PHASE_STRIP = NO; 459 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 460 | ENABLE_NS_ASSERTIONS = NO; 461 | ENABLE_STRICT_OBJC_MSGSEND = YES; 462 | GCC_C_LANGUAGE_STANDARD = gnu99; 463 | GCC_NO_COMMON_BLOCKS = YES; 464 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 465 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 466 | GCC_WARN_UNDECLARED_SELECTOR = YES; 467 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 468 | GCC_WARN_UNUSED_FUNCTION = YES; 469 | GCC_WARN_UNUSED_VARIABLE = YES; 470 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 471 | MTL_ENABLE_DEBUG_INFO = NO; 472 | SDKROOT = iphoneos; 473 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 474 | VALIDATE_PRODUCT = YES; 475 | }; 476 | name = Release; 477 | }; 478 | 607FACF01AFB9204008FA782 /* Debug */ = { 479 | isa = XCBuildConfiguration; 480 | baseConfigurationReference = EF213068310C0656F2567760 /* Pods-LLNetworkAccessibility-Swift_Example.debug.xcconfig */; 481 | buildSettings = { 482 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 483 | DEVELOPMENT_TEAM = P434QUZTFY; 484 | INFOPLIST_FILE = "LLNetworkAccessibility-Swift/Info.plist"; 485 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 486 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 487 | MODULE_NAME = ExampleApp; 488 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 489 | PRODUCT_NAME = "$(TARGET_NAME)"; 490 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 491 | SWIFT_VERSION = 5.0; 492 | }; 493 | name = Debug; 494 | }; 495 | 607FACF11AFB9204008FA782 /* Release */ = { 496 | isa = XCBuildConfiguration; 497 | baseConfigurationReference = 00477BF6F20D7EB82F4749E8 /* Pods-LLNetworkAccessibility-Swift_Example.release.xcconfig */; 498 | buildSettings = { 499 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 500 | DEVELOPMENT_TEAM = P434QUZTFY; 501 | INFOPLIST_FILE = "LLNetworkAccessibility-Swift/Info.plist"; 502 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 503 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 504 | MODULE_NAME = ExampleApp; 505 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 508 | SWIFT_VERSION = 5.0; 509 | }; 510 | name = Release; 511 | }; 512 | 607FACF31AFB9204008FA782 /* Debug */ = { 513 | isa = XCBuildConfiguration; 514 | baseConfigurationReference = A2F0350558C9375626D28864 /* Pods-LLNetworkAccessibility-Swift_Tests.debug.xcconfig */; 515 | buildSettings = { 516 | DEVELOPMENT_TEAM = P434QUZTFY; 517 | FRAMEWORK_SEARCH_PATHS = ( 518 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 519 | "$(inherited)", 520 | ); 521 | GCC_PREPROCESSOR_DEFINITIONS = ( 522 | "DEBUG=1", 523 | "$(inherited)", 524 | ); 525 | INFOPLIST_FILE = Tests/Info.plist; 526 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 527 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 528 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 529 | PRODUCT_NAME = "$(TARGET_NAME)"; 530 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 531 | SWIFT_VERSION = 5.0; 532 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LLNetworkAccessibility-Swift_Example.app/LLNetworkAccessibility-Swift_Example"; 533 | }; 534 | name = Debug; 535 | }; 536 | 607FACF41AFB9204008FA782 /* Release */ = { 537 | isa = XCBuildConfiguration; 538 | baseConfigurationReference = F3D8A64C96B1A553889E287A /* Pods-LLNetworkAccessibility-Swift_Tests.release.xcconfig */; 539 | buildSettings = { 540 | DEVELOPMENT_TEAM = P434QUZTFY; 541 | FRAMEWORK_SEARCH_PATHS = ( 542 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 543 | "$(inherited)", 544 | ); 545 | INFOPLIST_FILE = Tests/Info.plist; 546 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 547 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 548 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 549 | PRODUCT_NAME = "$(TARGET_NAME)"; 550 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 551 | SWIFT_VERSION = 5.0; 552 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LLNetworkAccessibility-Swift_Example.app/LLNetworkAccessibility-Swift_Example"; 553 | }; 554 | name = Release; 555 | }; 556 | /* End XCBuildConfiguration section */ 557 | 558 | /* Begin XCConfigurationList section */ 559 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "LLNetworkAccessibility-Swift" */ = { 560 | isa = XCConfigurationList; 561 | buildConfigurations = ( 562 | 607FACED1AFB9204008FA782 /* Debug */, 563 | 607FACEE1AFB9204008FA782 /* Release */, 564 | ); 565 | defaultConfigurationIsVisible = 0; 566 | defaultConfigurationName = Release; 567 | }; 568 | 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "LLNetworkAccessibility-Swift_Example" */ = { 569 | isa = XCConfigurationList; 570 | buildConfigurations = ( 571 | 607FACF01AFB9204008FA782 /* Debug */, 572 | 607FACF11AFB9204008FA782 /* Release */, 573 | ); 574 | defaultConfigurationIsVisible = 0; 575 | defaultConfigurationName = Release; 576 | }; 577 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "LLNetworkAccessibility-Swift_Tests" */ = { 578 | isa = XCConfigurationList; 579 | buildConfigurations = ( 580 | 607FACF31AFB9204008FA782 /* Debug */, 581 | 607FACF41AFB9204008FA782 /* Release */, 582 | ); 583 | defaultConfigurationIsVisible = 0; 584 | defaultConfigurationName = Release; 585 | }; 586 | /* End XCConfigurationList section */ 587 | }; 588 | rootObject = 607FACC81AFB9204008FA782 /* Project object */; 589 | } 590 | -------------------------------------------------------------------------------- /Example/LLNetworkAccessibility-Swift.xcodeproj/xcshareddata/xcschemes/LLNetworkAccessibility-Swift-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 45 | 46 | 48 | 54 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 80 | 82 | 88 | 89 | 90 | 91 | 92 | 93 | 99 | 101 | 107 | 108 | 109 | 110 | 112 | 113 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /Example/LLNetworkAccessibility-Swift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // LLNetworkAccessibility-Swift 4 | // 5 | // Created by lanlinxl on 12/07/2022. 6 | // Copyright (c) 2022 lanlinxl. 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 | -------------------------------------------------------------------------------- /Example/LLNetworkAccessibility-Swift/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Example/LLNetworkAccessibility-Swift/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 | -------------------------------------------------------------------------------- /Example/LLNetworkAccessibility-Swift/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Example/LLNetworkAccessibility-Swift/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 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Example/LLNetworkAccessibility-Swift/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // LLNetworkAccessibility-Swift 4 | // 5 | // Created by lanlinxl on 12/07/2022. 6 | // Copyright (c) 2022 lanlinxl. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import LLNetworkAccessibility_Swift 11 | 12 | class ViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | let label = UILabel() 17 | label.textColor = .blue 18 | label.font = .systemFont(ofSize: 18, weight: .medium) 19 | view.addSubview(label) 20 | label.frame = CGRect(x: 150, y: 120, width: 100, height: 30) 21 | 22 | let button = UIButton(type: .custom) 23 | button.setTitle("设置页按钮", for: .normal) 24 | button.setTitleColor(.gray, for: .normal) 25 | button.addTarget(self, action: #selector(buttonClick), for: .touchUpInside) 26 | button.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) 27 | view.addSubview(button) 28 | button.frame = CGRect(x: 150, y: label.frame.maxY + 30, width: 100, height: 30) 29 | 30 | 31 | LLNetworkAccessibility.start() 32 | LLNetworkAccessibility.configAlertStyle(type: .custom,closeEnable: false,tintColor: .red) 33 | LLNetworkAccessibility.reachabilityUpdateCallBack = { state in 34 | guard let state = state else { return } 35 | switch state { 36 | case .available: 37 | label.text = "网络已授权" 38 | case .restricted: 39 | label.text = "网络没授权" 40 | case .unknown: 41 | label.text = "没有网络(飞行模式)" 42 | default: 43 | break 44 | } 45 | 46 | } 47 | } 48 | 49 | @objc func buttonClick(){ 50 | if let url = URL(string: UIApplication.openSettingsURLString), UIApplication.shared.canOpenURL(url){ 51 | UIApplication.shared.open(url) 52 | } 53 | 54 | } 55 | 56 | } 57 | 58 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | platform :ios, '10.0' 4 | 5 | target 'LLNetworkAccessibility-Swift_Example' do 6 | pod 'LLNetworkAccessibility-Swift', :path => '../' 7 | 8 | target 'LLNetworkAccessibility-Swift_Tests' do 9 | inherit! :search_paths 10 | 11 | 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /Example/Tests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Tests/Tests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | class Tests: XCTestCase { 4 | 5 | override func setUp() { 6 | super.setUp() 7 | // Put setup code here. This method is called before the invocation of each test method in the class. 8 | } 9 | 10 | override func tearDown() { 11 | // Put teardown code here. This method is called after the invocation of each test method in the class. 12 | super.tearDown() 13 | } 14 | 15 | func testExample() { 16 | // This is an example of a functional test case. 17 | XCTAssert(true, "Pass") 18 | } 19 | 20 | func testPerformanceExample() { 21 | // This is an example of a performance test case. 22 | self.measure() { 23 | // Put the code you want to measure the time of here. 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022 lanlinxl 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /LLNetworkAccessibility-Swift.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = 'LLNetworkAccessibility-Swift' 4 | s.version = '1.0.3' 5 | s.summary = 'network authorization' 6 | 7 | s.description = 'network authorization' 8 | 9 | s.homepage = 'https://github.com/lanlinxl/LLNetworkAccessibility-Swift' 10 | s.license = { :type => 'MIT', :file => 'LICENSE' } 11 | s.author = { 'lanlinxl' => 'lanlin0806@icloud.com' } 12 | s.source = { :git => 'https://github.com/lanlinxl/LLNetworkAccessibility-Swift.git', :tag => s.version.to_s } 13 | 14 | s.ios.deployment_target = '10.0' 15 | 16 | s.source_files = 'LLNetworkAccessibility-Swift/Classes/**/*' 17 | s.resource = 'LLNetworkAccessibility-Swift/LLNetworkAccessibility.bundle' 18 | # s.resource_bundles = { 19 | # 'LLNetworkAccessibility-Swift' => ['LLNetworkAccessibility-Swift/Assets/*'] 20 | # } 21 | s.swift_version = '5.0' 22 | 23 | end 24 | -------------------------------------------------------------------------------- /LLNetworkAccessibility-Swift/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanlinxl/LLNetworkAccessibility-Swift/4afec8af963a5e3a27207a27c7251f7d6e7c26c2/LLNetworkAccessibility-Swift/Assets/.gitkeep -------------------------------------------------------------------------------- /LLNetworkAccessibility-Swift/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanlinxl/LLNetworkAccessibility-Swift/4afec8af963a5e3a27207a27c7251f7d6e7c26c2/LLNetworkAccessibility-Swift/Classes/.gitkeep -------------------------------------------------------------------------------- /LLNetworkAccessibility-Swift/Classes/LLAccessibilityAlertController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LLAccessibilityAlertController.swift 3 | // test 4 | // 5 | // Created by lzwk_lanlin on 2022/12/2. 6 | // Copyright © 2022 Weike. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class LLAccessibilityAlertController: UIViewController { 13 | /// 弹框背景view 14 | private lazy var bgView: UIView = { 15 | let bgView = UIView() 16 | bgView.layer.cornerRadius = 12 17 | bgView.layer.masksToBounds = true 18 | bgView.backgroundColor = .white 19 | return bgView 20 | }() 21 | 22 | /// 关闭 23 | private lazy var closeButton: UIButton = { 24 | let button = UIButton(type: .custom) 25 | button.addTarget(self, action: #selector(closeAction), for: .touchUpInside) 26 | return button 27 | }() 28 | 29 | /// 主标题 30 | private lazy var titleLb: UILabel = { 31 | let titleLb = UILabel() 32 | titleLb.font = .systemFont(ofSize: 16, weight: .medium) 33 | titleLb.textColor = UIColor(red: 51 / 255.0, green: 51 / 255.0, blue: 51 / 255.0, alpha: 1.0) 34 | titleLb.textAlignment = .center 35 | titleLb.text = "开启网络权限" 36 | return titleLb 37 | }() 38 | 39 | /// 副标题 40 | private lazy var desLabel1: UILabel = { 41 | let label = UILabel() 42 | label.font = .systemFont(ofSize: 12) 43 | label.textColor = UIColor(red: 150 / 255.0, green: 154 / 255.0, blue: 173 / 255.0, alpha: 1.0) 44 | label.text = "1.跳转到设置页后,点击 无线数据" 45 | return label 46 | }() 47 | 48 | private lazy var desImageView1: UIImageView = { 49 | let imageView = UIImageView() 50 | imageView.image = imageNamed(name: "LLAccessibilityImage1") 51 | return imageView 52 | }() 53 | 54 | private lazy var desLabel2: UILabel = { 55 | let label = UILabel() 56 | label.font = .systemFont(ofSize: 12) 57 | label.textColor = UIColor(red: 150 / 255.0, green: 154 / 255.0, blue: 173 / 255.0, alpha: 1.0) 58 | label.text = "2.选中 WLAN 与蜂窝网络" 59 | return label 60 | }() 61 | 62 | private lazy var desImageView2: UIImageView = { 63 | let imageView = UIImageView() 64 | imageView.image = imageNamed(name: "LLAccessibilityImage2") 65 | return imageView 66 | }() 67 | 68 | lazy var setButton: UIButton = { 69 | let button = UIButton(type: .custom) 70 | button.setTitle("立即设置", for: .normal) 71 | button.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) 72 | button.setTitleColor(UIColor.red, for: .normal) 73 | button.setTitleColor(UIColor(red: 242 / 255.0, green: 246 / 255.0, blue: 252 / 255.0, alpha: 1.0), for: .highlighted) 74 | button.addTarget(self, action: #selector(setButtonClick), for: .touchUpInside) 75 | return button 76 | }() 77 | 78 | /// 弹框是否可关闭 79 | var closeAlertEnable: Bool = false 80 | 81 | convenience init(){ 82 | self.init(nibName: nil, bundle: nil) 83 | modalTransitionStyle = .crossDissolve 84 | modalPresentationStyle = .overFullScreen 85 | view.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.6) 86 | setupBaseView() 87 | } 88 | override public func viewDidLoad() { 89 | super.viewDidLoad() 90 | modalTransitionStyle = .crossDissolve 91 | modalPresentationStyle = .overFullScreen 92 | } 93 | 94 | func setupBaseView() { 95 | view.addSubview(closeButton) 96 | closeButton.frame = view.bounds 97 | 98 | view.addSubview(bgView) 99 | bgView.addSubview(titleLb) 100 | bgView.addSubview(desLabel1) 101 | bgView.addSubview(desImageView1) 102 | bgView.addSubview(desLabel2) 103 | bgView.addSubview(desImageView2) 104 | bgView.addSubview(setButton) 105 | bgView.frame = CGRect(x: UIScreen.main.bounds.size.width / 2 - 130, y: UIScreen.main.bounds.size.height / 2 - 110, width: 260, height: 220) 106 | titleLb.frame = CGRect(x: 0, y: 16, width: 260, height: 20) 107 | desLabel1.frame = CGRect(x: 20, y: 50, width: 240, height: 12) 108 | desImageView1.frame = CGRect(x: 20, y: desLabel1.frame.maxY + 4, width: 220, height: 32) 109 | desLabel2.frame = CGRect(x: 20, y: desImageView1.frame.maxY + 8, width: 220, height: 12) 110 | desImageView2.frame = CGRect(x: 20, y: desLabel2.frame.maxY + 4, width: 220, height: 32) 111 | let line = UIView() 112 | line.backgroundColor = UIColor(red: 242 / 255.0, green: 246 / 255.0, blue: 252 / 255.0, alpha: 1.0) 113 | bgView.addSubview(line) 114 | line.frame = CGRect(x: 0, y: desImageView2.frame.maxY + 16, width: 260, height: 0.5) 115 | setButton.frame = CGRect(x: 0, y: line.frame.maxY , width: 260, height: 44) 116 | } 117 | 118 | @objc func setButtonClick(){ 119 | if let url = URL(string: UIApplication.openSettingsURLString), UIApplication.shared.canOpenURL(url){ 120 | UIApplication.shared.open(url) 121 | }else { 122 | self.dismiss(animated: true) 123 | } 124 | } 125 | 126 | @objc func closeAction() { 127 | if closeAlertEnable{ 128 | view.removeFromSuperview() 129 | } 130 | } 131 | } 132 | 133 | 134 | extension LLAccessibilityAlertController { 135 | func imageNamed(name: String) -> UIImage? { 136 | let currentBundle = Bundle(for: LLAccessibilityAlertController.self) 137 | if let bundlePath = currentBundle.path(forResource: "LLNetworkAccessibility", ofType: "bundle") { 138 | let image = UIImage(contentsOfFile: bundlePath + "/\(name).png") 139 | return image 140 | } 141 | return nil 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /LLNetworkAccessibility-Swift/Classes/LLNetworkAccessibility.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SFNetworkAccessibility.swift 3 | // test 4 | // 5 | // Created by lzwk_lanlin on 2022/11/30. 6 | // Copyright © 2022 Weike. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import CoreTelephony 11 | import SystemConfiguration.CaptiveNetwork 12 | import UIKit 13 | 14 | private extension Notification.Name { 15 | static let LLNetworkStateChangedNotification = Notification.Name("LLNetworkAccessibilityChangedNotification") 16 | } 17 | 18 | public class LLNetworkAccessibility: NSObject { 19 | // 网络类型 20 | private enum NetworkType: String { 21 | case unknown 22 | case offline 23 | case wifi 24 | case cellular 25 | } 26 | 27 | // 授权类型 28 | public enum AuthState: String { 29 | // 检测中 30 | case checking 31 | // 未知(飞行模式) 32 | case unknown 33 | // 授权可用 34 | case available 35 | // 未授权 36 | case restricted 37 | } 38 | 39 | // 弹框类型 40 | public enum AlertType: String { 41 | /// 无弹框(默认) 42 | case none 43 | /// 自定义的弹框 44 | case custom 45 | } 46 | 47 | private static let shared = LLNetworkAccessibility() 48 | /// 弹框类型 49 | private var alertType: AlertType = .none 50 | /// 上次保存的状态 51 | private var previousState: AuthState = .checking 52 | private var reachabilityRef: SCNetworkReachability? 53 | private var cellularData: CTCellularData? 54 | private var reachabilityCallBack: SCNetworkReachabilityCallBack? 55 | /// 进入前台是否检查网络授权 56 | private var checkingWithBecomeActive: Bool = false 57 | /// 是否自动弹框 58 | private var isAutomaticallyAlert: Bool = false 59 | /// 自定义设置弹框 60 | private lazy var customAlertController = LLAccessibilityAlertController() 61 | /// 网络类型切换回调 62 | public static var reachabilityUpdateCallBack: ((_ state: AuthState?) -> Void)? 63 | 64 | private override init() { 65 | super.init() 66 | addReachabilityCallBack() 67 | } 68 | } 69 | 70 | //MARK: public method 71 | extension LLNetworkAccessibility{ 72 | /// 开启检测 73 | public static func start(){ 74 | LLNetworkAccessibility.shared.setupNetworkAccessibility() 75 | } 76 | /// 停止检测 77 | public static func stop(){ 78 | LLNetworkAccessibility.shared.stopAndClean() 79 | } 80 | 81 | /// 配置未授权的提示框 82 | /// - Parameters: 83 | /// - type: none 不展示弹框 , custom 展示自定义弹框 84 | /// - closeEnable: 点击背景是否可关闭弹框 85 | /// - tintColor: 设置按钮的文字颜色 86 | public static func configAlertStyle(type: AlertType , closeEnable: Bool = false , tintColor: UIColor = UIColor.red){ 87 | LLNetworkAccessibility.shared.configAlert(type: type,closeEnable: closeEnable,tintColor: tintColor) 88 | } 89 | 90 | /// 当前的授权状态 91 | public static func getCurrentAuthState() -> AuthState{ 92 | return LLNetworkAccessibility.shared.previousState 93 | } 94 | } 95 | 96 | 97 | //MARK: private method 98 | extension LLNetworkAccessibility{ 99 | // 配置提示弹框 100 | private func configAlert(type: AlertType , closeEnable: Bool = false , tintColor: UIColor = UIColor.red){ 101 | alertType = type 102 | switch type { 103 | case .custom: 104 | isAutomaticallyAlert = true 105 | customAlertController.closeAlertEnable = closeEnable 106 | customAlertController.setButton.setTitleColor(tintColor, for: .normal) 107 | case .none: 108 | isAutomaticallyAlert = false 109 | } 110 | } 111 | 112 | // 停止检测 113 | private func stopAndClean(){ 114 | cellularData?.cellularDataRestrictionDidUpdateNotifier = nil 115 | cellularData = nil 116 | previousState = .checking 117 | reachabilityCallBack = nil 118 | NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(ensureActive), object: nil) 119 | hiddenAlert() 120 | NotificationCenter.default.removeObserver(self, name: UIApplication.willResignActiveNotification, object: nil) 121 | NotificationCenter.default.removeObserver(self, name: UIApplication.didBecomeActiveNotification, object: nil) 122 | print("NetworkAccessibility 已清除") 123 | } 124 | 125 | // 设置网络授权相关 126 | private func setupNetworkAccessibility(){ 127 | if (isSimulator()) { 128 | // 模拟器检测默认通过 129 | updateAccessibility(with: .available) 130 | } 131 | if reachabilityRef != nil || cellularData != nil { 132 | startCheck() 133 | return 134 | } 135 | guard let reachabilityRef = SCNetworkReachabilityCreateWithName(nil, "223.5.5.5") , let modeString = CFRunLoopMode.defaultMode?.rawValue else { return } 136 | NotificationCenter.default.addObserver(self, selector: #selector(appWillResignActive), name: UIApplication.willResignActiveNotification, object: nil) 137 | NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive), name: UIApplication.didBecomeActiveNotification, object: nil) 138 | 139 | self.reachabilityRef = reachabilityRef 140 | SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(),modeString) 141 | 142 | let firstRunFlag = "LLNetworkAccessibilityFirstRunFlag" 143 | if UserDefaults.standard.value(forKey: firstRunFlag) as? Bool == nil { 144 | UserDefaults.standard.set(true, forKey: firstRunFlag) 145 | Delay(4) { 146 | self.startReachabilityNotifier() 147 | self.startCellularDataNotifier() 148 | } 149 | }else { 150 | self.startReachabilityNotifier() 151 | self.startCellularDataNotifier() 152 | } 153 | } 154 | 155 | 156 | 157 | // 监听用户从 Wi-Fi 切换到 蜂窝数据,或者从蜂窝数据切换到 Wi-Fi,另外当从授权到未授权,或者未授权到授权也会调用该方法 158 | private func startReachabilityNotifier(){ 159 | guard let reachabilityRef = reachabilityRef , let modeString = CFRunLoopMode.defaultMode?.rawValue else { return } 160 | let selfPointer = UnsafeRawPointer(Unmanaged.passUnretained(self).toOpaque()) 161 | var context = SCNetworkReachabilityContext(version: 0, info: UnsafeMutableRawPointer(mutating: selfPointer) , retain: nil, release: nil, copyDescription: nil) 162 | if SCNetworkReachabilitySetCallback(reachabilityRef, reachabilityCallBack, &context){ 163 | SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), modeString); 164 | } 165 | } 166 | 167 | private func addReachabilityCallBack(){ 168 | // 用户从 Wi-Fi 切换到 蜂窝数据,或者从蜂窝数据切换到 Wi-Fi 的回调 169 | reachabilityCallBack = { _ , _ ,info in 170 | if let pointer = UnsafeRawPointer(info){ 171 | let mySelf = Unmanaged.fromOpaque(pointer).takeUnretainedValue() 172 | mySelf.startCheck() 173 | } 174 | } 175 | } 176 | 177 | private func startCellularDataNotifier(){ 178 | let cellularData = CTCellularData() 179 | self.cellularData = cellularData 180 | cellularData.cellularDataRestrictionDidUpdateNotifier = {[weak self] _ in 181 | DispatchQueue.main.async { 182 | self?.startCheck() 183 | } 184 | } 185 | } 186 | 187 | // 开始检测 188 | private func startCheck(){ 189 | if (currentReachable()){ 190 | print("网络可用") 191 | return updateAccessibility(with: .available) 192 | } 193 | guard let cellularData = cellularData else { return } 194 | let state = cellularData.restrictedState 195 | switch state { 196 | case .restricted: 197 | /* 若用户是通过蜂窝数据 或 WLAN 上网,走到这里来 说明权限被关闭**/ 198 | if isUseWifiConnect() || isUseWWANConnect(){ 199 | print("网络没授权") 200 | updateAccessibility(with: .restricted) 201 | }else { 202 | print("飞行模式") 203 | updateAccessibility(with: .unknown) 204 | } 205 | case .notRestricted: 206 | print("网络可用") 207 | updateAccessibility(with: .available) 208 | case .restrictedStateUnknown: 209 | Delay(0.5) { 210 | self.startCheck() 211 | } 212 | default: 213 | break 214 | } 215 | } 216 | 217 | /* currentReachable 若返回的为 YES 则说明: 218 | 1. 用户选择了 「WALN 与蜂窝移动网」并处于其中一种网络环境下。 219 | 2. 用户选择了 「WALN」并处于 WALN 网络环境下。 220 | **/ 221 | private func currentReachable() -> Bool{ 222 | guard let reachabilityRef = reachabilityRef else { return false} 223 | var flags = SCNetworkReachabilityFlags() 224 | if SCNetworkReachabilityGetFlags(reachabilityRef, &flags){ 225 | return flags.contains(.reachable) 226 | } 227 | return false 228 | } 229 | 230 | /// 是否在使用wifi连接 231 | private func isUseWifiConnect() -> Bool{ 232 | var address: String? 233 | var ifaddr: UnsafeMutablePointer? = nil 234 | guard getifaddrs(&ifaddr) == 0 , let firstAddr = ifaddr else { 235 | return false 236 | } 237 | for ifptr in sequence(first: firstAddr, next: { $0.pointee.ifa_next }) { 238 | let interface = ifptr.pointee 239 | // Check for IPV4 or IPV6 interface 240 | let addrFamily = interface.ifa_addr.pointee.sa_family 241 | if addrFamily == UInt8(AF_INET) || addrFamily == UInt8(AF_INET6) { 242 | // Check interface name 243 | let name = String(cString: interface.ifa_name) 244 | if name == "en0" { 245 | // Convert interface address to a human readable string 246 | var addr = interface.ifa_addr.pointee 247 | var hostName = [CChar](repeating: 0, count: Int(NI_MAXHOST)) 248 | getnameinfo(&addr,socklen_t(interface.ifa_addr.pointee.sa_len), &hostName, socklen_t(hostName.count), nil, socklen_t(0), NI_NUMERICHOST) 249 | address = String(cString: hostName) 250 | } 251 | } 252 | } 253 | freeifaddrs(ifaddr) 254 | if let wifiIP = address , wifiIP.count > 0 { 255 | return true 256 | } 257 | return false 258 | } 259 | 260 | // 是否在使用蜂窝网络连接(3G、4G、5G) 261 | private func isUseWWANConnect() -> Bool { 262 | guard let reachabilityRef = reachabilityRef else { return false} 263 | var flags = SCNetworkReachabilityFlags() 264 | if SCNetworkReachabilityGetFlags(reachabilityRef, &flags){ 265 | print("是否是蜂窝网络:\(flags.contains(.isWWAN))") 266 | return flags.contains(.isWWAN) 267 | } 268 | return false 269 | } 270 | 271 | // 更新网络状态 272 | private func updateAccessibility(with state: AuthState){ 273 | if (isAutomaticallyAlert){ 274 | state == .restricted ? showAlert() : hiddenAlert() 275 | } 276 | // 状态发生变化 277 | if state != previousState { 278 | previousState = state 279 | LLNetworkAccessibility.reachabilityUpdateCallBack?(state) 280 | NotificationCenter.default.post(name: .LLNetworkStateChangedNotification, object: nil) 281 | } 282 | } 283 | 284 | /// 延时调用 285 | private func Delay(_ time: TimeInterval, queue: DispatchQueue = .main, closure: @escaping () -> Void) { 286 | queue.asyncAfter(deadline: .now() + time) { closure() } 287 | } 288 | 289 | /// 是否是模拟器 290 | private func isSimulator() -> Bool{ 291 | #if TARGET_OS_SIMULATOR 292 | return true 293 | #else 294 | return false 295 | #endif 296 | } 297 | } 298 | 299 | 300 | // MARK: - Active Check 301 | extension LLNetworkAccessibility{ 302 | @objc private func appWillResignActive(){ 303 | hiddenAlert() 304 | NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(ensureActive), object: nil) 305 | checkingWithBecomeActive = true 306 | } 307 | 308 | @objc private func appDidBecomeActive(){ 309 | if checkingWithBecomeActive { 310 | checkingWithBecomeActive = false 311 | perform(#selector(ensureActive), with: nil, afterDelay: 1.5,inModes: [RunLoop.Mode.common]) 312 | } 313 | } 314 | 315 | @objc private func ensureActive(){ 316 | startReachabilityNotifier() 317 | startCellularDataNotifier() 318 | } 319 | } 320 | 321 | // MARK: - Alert About 322 | extension LLNetworkAccessibility{ 323 | // 展示弹框 324 | func showAlert(){ 325 | if customAlertController.view.superview == nil{ 326 | UIApplication.shared.keyWindow?.addSubview(customAlertController.view) 327 | customAlertController.view.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: UIScreen.main.bounds.size.height) 328 | } 329 | } 330 | // 隐藏弹框 331 | func hiddenAlert(){ 332 | customAlertController.view.removeFromSuperview() 333 | } 334 | } 335 | -------------------------------------------------------------------------------- /LLNetworkAccessibility-Swift/LLNetworkAccessibility.bundle/LLAccessibilityImage1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanlinxl/LLNetworkAccessibility-Swift/4afec8af963a5e3a27207a27c7251f7d6e7c26c2/LLNetworkAccessibility-Swift/LLNetworkAccessibility.bundle/LLAccessibilityImage1.png -------------------------------------------------------------------------------- /LLNetworkAccessibility-Swift/LLNetworkAccessibility.bundle/LLAccessibilityImage2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanlinxl/LLNetworkAccessibility-Swift/4afec8af963a5e3a27207a27c7251f7d6e7c26c2/LLNetworkAccessibility-Swift/LLNetworkAccessibility.bundle/LLAccessibilityImage2.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LLNetworkAccessibility-Swift 2 | 3 | [![CI Status](https://img.shields.io/travis/lanlinxl/LLNetworkAccessibility-Swift.svg?style=flat)](https://travis-ci.org/lanlinxl/LLNetworkAccessibility-Swift) 4 | [![Version](https://img.shields.io/cocoapods/v/LLNetworkAccessibility-Swift.svg?style=flat)](https://cocoapods.org/pods/LLNetworkAccessibility-Swift) 5 | [![License](https://img.shields.io/cocoapods/l/LLNetworkAccessibility-Swift.svg?style=flat)](https://cocoapods.org/pods/LLNetworkAccessibility-Swift) 6 | [![Platform](https://img.shields.io/cocoapods/p/LLNetworkAccessibility-Swift.svg?style=flat)](https://cocoapods.org/pods/LLNetworkAccessibility-Swift) 7 | 8 | 9 | 10 | ## Installation 11 | 12 | LLNetworkAccessibility-Swift is available through [CocoaPods](https://cocoapods.org). To install 13 | it, simply add the following line to your Podfile: 14 | 15 | ```ruby 16 | pod 'LLNetworkAccessibility-Swift' 17 | ``` 18 | ## Example 19 | ```ruby 20 | // 1. 开启检测 21 | LLNetworkAccessibility.start() 22 | 23 | // 2. 配置自定义弹框 24 | LLNetworkAccessibility.configAlertStyle(type: .custom,closeEnable: false,tintColor: .red) 25 | 26 | // 3. 网络授权监听 27 | LLNetworkAccessibility.reachabilityUpdateCallBack = { state in 28 | guard let state = state else { return } 29 | switch state { 30 | case .available: 31 | print("网络已授权") 32 | case .restricted: 33 | print("网络没授权") 34 | case .unknown: 35 | print("没有网络(飞行模式)") 36 | default: 37 | break 38 | } 39 | } 40 | ``` 41 | 42 | ## Sample graph 43 | ![wecom-temp-3333310-b849c7c289043303f0a7cf115841ad97](https://user-images.githubusercontent.com/38074234/206689390-d110724b-1c8c-4d39-a89c-cfb0b43acb83.gif) 44 | 45 | ## My information 46 | ```javascript 47 | var info = { 48 | nickName : "lanlinxl", 49 | address : "https://juejin.cn/post/7175080567648550969" 50 | } 51 | ``` 52 | 53 | ## License 54 | 55 | LLNetworkAccessibility-Swift is available under the MIT license. See the LICENSE file for more info. 56 | 57 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------