A recieved signal strength indicator view, inpired by iOS 11 cellular signal indicator
EFSignalBariOS is available through CocoaPods. Deployment Target is iOS 10 or greater. To install it, simply add the following line to your Podfile:
pod 'EFSignalBariOS'
Import the project as shown:
import EFSignalBariOS
Drag a UIView to your storyboard and change it's class to EFSignalBariOS. The view will update to show the signal bars and the following properties can be changed from the storyboard's Attribute inspector:
- Base Color: The background color of the signal bar when not highlighted
- Low Signal Color
- Moderate signal color
- Excellent signal Color
@objc public enum SignalStrength: Int {
case Excellent = 4
case Good = 3
case Low = 2
case VeryLow = 1
case Unknown = 0
}
- Create an outlet from the Slider View on the story board to your View controller.
@IBOutlet weak var signalView: EFSignalBarView!
- The signal Strength can be supplied to the signal view as follows:
signalView.signal = EFSignalBarView.SignalStrength(rawValue: 4 )! //or 3, 2, 1, 0
- You can create a function that converts to Signal Strength:
func convertToSignalStrength(value: Float) -> Int{
if value > 0.0 && value <= 0.3 {
return 1
}else if value > 0.3 && value <= 0.5 {
return 2
}else if value > 0.5 && value <= 0.7 {
return 3
}else if value > 0.7 && value <= 1 {
return 4
}else{
return 0
}
}
Erhies Feka, erhiesfeka@yahoo.com
EFSignalBariOS is available under the MIT license.