device-kit 
Last Update: 06/April/2019.
If you like the project, please give it a star ⭐ It will show the creator your appreciation and help others to discover the repo.
✍️ About
iOS device.
🏗 Installation
CocoaPods
device-kit is availabe via CocoaPods
pod 'device-kit', '~> 1.1.1'
Manual
You can always use copy-paste the sources method
📚 Features
- Device Type information
- Easily get a device's
identifier - Determine if an app running on a
simulatoror on an actual device - Includes information about an each
iOSdevice
- Easily get a device's
- Device Storage status such as:
TotalspaceFreespaceUsedspace- You can format the data using various
units(by usingByteCountFormatter.Units)
- Device Orientation information
- Check whether the device is in
.portraitor.landscapeorientation without the need to make boilerplateUIDevice.current.orientationcalls &if/elsechecks - You can use
isPortraitproperty if you'd like
- Check whether the device is in
- Device's Internet Connection status
- Super easily check whether your device is connected to the internet
- You can get the reachability status as well
✈️ Usage
Getting device's identifier:
let identifiers = UIDevice.current.deviceType
// `identifiers` will hold the corresponding devices' identifiers depending on your `iOS` modelDeterming how much storage has left:
UIDevice.current.storageStatus.getFreeSpace(.useMB)
// Will print something like this:
// 139,197.3 MB
UIDevice.current.storageStatus.getFreeSpace(.useGB)
// Or you can change the unit type to Gigabytes:
// 139.16 GB
UIDevice.current.storageStatus.getFreeSpace(.useGB, includeUnitPostfix: false)
// If you don't want to get GB, MB postfixes then specify an optional parameter for `includeUnitPostfix`:
// 139.16Checking the device's orientation:
let orienation = UIDevice.current.deviceOrientation
switch orientation {
case .portrait:
showDrawerView()
case .landscape:
hideDrawerView()
}Getting the internet connection status:
let internet = UIDevice.current.internetConnection
guard internet.connection == .open else {
throw NetworkError.isNotAvailabe("Missing internet connection")
}
sendRequest()📝 ToDo
- Lightweight
Networkreachability (withNotificationCentersupport or more safer approach in observing changes)-
NotificationCenterobserver support
-
- Device
orientation-
NotificationCenterobserver support
-
- Interface
orientation-
NotificationCenterobserver support
-
🙋♀️ 🙋♂️ Contributing
- There is just one main rule for contributors - please include your extensions in separete files. It's important since such extension can be more easily referenced and reused.
- The other
softrule is - please includeunit testswith your extensions.
👨💻 Author
🔖 Licence
The project is available under MIT licence
