Wi-Fi Helper
An iOS framework for programmatically connecting to Wi-Fi networks. (HotspotHelper entitlement is required)
Contents of this Readme
Installation
CocoaPods
WiFiHelper is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "WiFiHelper"
Carthage
WiFiHelper is available through Carthage. To install it, simply add the following line to your Cartfile:
github "Astranno/WiFiHelper" == 1.0.3
Submodule
If you don't use CocoaPods, you can still add WiFiHelper as a submodule, drag and drop WiFiHelper.xcodeproj into your project, and embed WiFiHelper.framework in your target.
- Drag
WiFiHelper.xcodeprojto your project - Select your app target
- Click the
+button on theEmbedded binariessection - Add
WiFiHelper.framework
Manual
You can directly drag and drop the needed files into your project, but keep in mind that this way you won't be able to automatically get all the latest WiFiHelper features.
Usage
The com.apple.developer.networking.HotspotHelper entitlement is required in order to use NEHotspotHelper. To request this entitlement, complete the questionnaire at https://developer.apple.com/contact/network-extension.
Setup
Make sure to import WiFiHelper:
import WiFiHelperCreating a Network
First thing you have to do is to create a network. There are a few types dependant on the encryption type.
Unsecured Network
let network = Network(ssid: "NETWORK SSID")Network with WEP Encryption
let network = Network(ssid: "NETWORK SSID", password: "NETWORK PASSWORD", isWEP: true)Network with WPA/WPA2 Personal Encryption
let network = Network(ssid: "NETWORK SSID", password: "NETWORK PASSWORD", isWEP: false)Connecting to a Network
To connect to a network, use the following method:
network.connect { (error) in
//completion block
}Check Connection
To check whether or not a user is connected to a network, use the following method:
let isConnectedToNetwork: Bool = network.isConnected()Authors
WiFiHelper was made by Astranno
Apps that Use Wi-Fi Helper
License
WiFiHelper is available under the MIT license. See the LICENSE file for more info.