Welcome to UIKitX, a UI/UX framework easy & powerful for human use to create beautiful applications.
Features
- Clean Swift 5 Code.
- Shortest possible syntax for all features.
- Easy UIView syntax call.
- Easy make or select shadows.
- Easy make or select Parallax.
- Convenience call color.
- Convenience call HexColor.
- Extension Material Design Color.
- Easy make or select Gradient.
- Easy make Modern alerts system.
- Easy syntax & make layout constraints.
- Easy syntax & make animation.
- And more in the future.
Installation
CocoaPods. To install it, simply add the following line to your Podfile:
UIKitX is available throughpod 'UIKitX', '~> 0.1.10'
Usage
UIKitX
module
Import import UIKitX
Easy
border
syntax
Easy: border(width: CGFloat, color: UIColor)
border(width: CGFloat, color: UIColor, views: UIView...)
border
Examples Usage let x = UIView()
x.border(width: 5, color: .white)
let x1 = UIView()
let x2 = UIView()
let x3 = UIView()
x1.border(width: 5, color: .white, views: x2,x3)
borderWidth
syntax
Easy: borderWidth(_ set: CGFloat)
borderWidth(_ set: CGFloat, views: UIView...)
borderWidth
Examples Usage let x = UIView()
x.borderWidth(5)
let x1 = UIView()
let x2 = UIView()
let x3 = UIView()
x1.borderWidth(5, views: x2,x3)
borderColor
syntax
Easy: borderColor(_ set: UIColor)
borderColor(_ set: UIColor, views: UIView...)
borderColor
Examples Usage let x = UIView()
x.borderColor(.purple)
let x1 = UIView()
let x2 = UIView()
let x3 = UIView()
x1.borderColor(.white, views: x2,x3)
cornerEdges
syntax
Easy: cornerEdges(_ set: CGFloat)
cornerEdges(_ active: Bool) // Active as default is true
cornerEdges(_ set: CGFloat, views: UIView...)
cornerEdges(_ active: Bool, views: UIView...) // Active as default is true
cornerEdges
Examples Usage let x = UIView()
x.cornerEdges(13)
let x = UIView()
x.cornerEdges(true)
let x1 = UIView()
let x2 = UIView()
let x3 = UIView()
x1.cornerEdges(8, views: x2,x3)
let x1 = UIView()
let x2 = UIView()
let x3 = UIView()
x1.cornerEdges(true, views: x2,x3)
maskedCorners
syntax
Easy: maskedCorners(_ set: CACornerMask)
maskedCorners(_ set: CACornerMask, views: UIView...)
Select one or more
.top
| .left
| .right
| .bottom
| .topRight
| .topLeft
| .bottomRight
| .bottomLeft
maskedCorners
Examples Usage let x = UIView()
x.cornerEdges(10).maskedCorners(.top)
let x = UIView()
x.cornerEdges(20).maskedCorners([.topLeft,.bottomRight])
let x1 = UIView()
let x2 = UIView()
let x3 = UIView()
x1.maskedCorners([.topLeft,.bottomRight], views: x2,x3)
maskView
syntax
Easy: maskView(_ active: Bool) // Active as default is true
maskView(_ active: Bool = true, views: UIView...) // Active as default is true
maskView
Examples Usage let x = UIView()
x.maskView()
let x = UIView()
x.maskView(true, views: x2,x3)
clipView
syntax
Easy: clipView(_ active: Bool) // Active as default is true
clipView(_ active: Bool, views: UIView...) // Active as default is true
clipView
Examples Usage let x = UIView()
x.clipView()
let x = UIView()
x.clipView(false, views: x2,x3)
backColor
syntax
Easy: backColor(_ set: UIColor)
backColor(_ set: UIColor, views: UIView...)
backColor
Examples Usage let x = UIView()
x.backColor(.white)
let x1 = UIView()
let x2 = UIView()
let x3 = UIView()
x1.backColor(.purple, views: x2,x3)
addSubviews
syntax
Easy: addSubviews(_ views: UIView...)
addSubviews
Examples Usage let x1 = UIView()
let x2 = UIView()
let x3 = UIView()
view.addSubviews(x1,x2,x3)
parallax
syntax
Easy: parallax(_ set: CGFloat)
parallax(min: CGFloat, max: CGFloat)
parallax(_ strength: ParallaxStrength)
Select Strength
.ExtraLow
| .Low
| .Mid
| .High
| .ExtraHigh
parallax
Examples Usage let x = UIView()
x.parallax()
let x = UIView()
x.parallax(15)
let x = UIView()
x.parallax(min: -20, max: 35)
let x = UIView()
x.parallax(.High)
shadow
syntax
Easy: shadow()
shadow(_ color: UIColor, // As default is .black
_ opacity: Float, // As default is 0.10
_ blur: CGFloat, // As default is 10.0
_ x: CGFloat, // As default is 0.0
_ y: CGFloat) // As default is 8.0
shadow(_ elevation: Elevation)
shadow(_ elevation: Elevation, color: UIColor)
Select Elevation
.none
.top1
| .top2
| .top3
| .top4
| .top5
.down1
| .down2
| .down3
| .down4
| .down5
.left1
| .left2
| .left3
| .left4
| .left5
.right1
| .right2
| .right3
| .right4
| .right5
shadow
Examples Usage let x = UIView()
x.shadow()
let x = UIView()
x.shadow(.black, 0.10, 10.0, 0.0, 8.0)
let x = UIView()
x.shadow(.down4)
let x = UIView()
x.shadow(.down4, color: .purple)
Color
convenience UIColor
syntax
Color: UIColor(r: CGFloat, g: CGFloat, b: CGFloat)
UIColor(r: CGFloat, g: CGFloat, b: CGFloat,_ opacity: CGFloat)
UIColor(red: CGFloat, green: CGFloat, blue: CGFloat)
UIColor(red: CGFloat, green: CGFloat, blue: CGFloat,_ opacity: CGFloat)
convenience UIColor
Examples Usage let x = UIView()
let c = UIColor(r: 218, g: 68, b: 83)
x.backColor(c)
let x = UIView()
let c = UIColor(r: 218, g: 68, b: 83, 0.5)
x.backColor(c)
let x = UIView()
let c = UIColor(red: 102, green: 230, blue: 255)
x.backColor(c)
let x = UIView()
let c = UIColor(red: 102, green: 230, blue: 255, 0.8)
x.backColor(c)
hexColor
syntax
Color: UIColor(_ hex: Hex)
UIColor(_ hex: Hex, alpha: CGFloat?)
Hexadecimal value
hex3: Three-digit hexadecimal value
| RGB defines to the color #RGB
hex4: Four-digit hexadecimal value
| RGBA defines to the color #RGBA
hex6: Six-digit hexadecimal value
| RGB defines to the color #RRGGBB
hex8: Eight-digit hexadecimal value
| RGBA defines to the color #RRGGBBAA
hexColor
Examples Usage let x = UIView()
let c = UIColor("#03A9F4")
x.backColor(c)
Or with out #
let x = UIView()
let c = UIColor("03A9F4")
x.backColor(c)
let x = UIView()
x.border(width: 5, color: UIColor("03A9F4"))
let x = UIView()
x.shadow(UIColor("#03A9F4", alpha: 0.3))
materialColor
syntax
Color: UIColor.materialColor
hexColor
Examples Usage let x = UIView()
x.backColor(.Red500)
let x = UIView()
x.border(width: 5, color: .DeepPurple500)
let x = UIView()
x.shadow(.down4, color: .Teal200)
Material colors palette
Gradient
Initializers
syntax
Gradient: UIGradient(colors: [UIColor])
UIGradient(colors: [UIColor],
start: AxesPoint,
end: AxesPoint,
locations: [NSNumber]?,
cornerEdges: CGFloat,
roundEdges: Bool,
style: CAGradientLayerType)
UIGradient(_ set: Gradients)
UIGradient(_ set: Gradients,
start: AxesPoint,
end: AxesPoint,
locations: [NSNumber]?,
cornerEdges: CGFloat,
roundEdges: Bool,
style: CAGradientLayerType)
Properties
Gradient: colors: [UIColor]
| start: AxesPoint
| end: AxesPoint
| locations: [NSNumber]?
| cornerEdges: CGFloat
| roundEdges: Bool
| style: CAGradientLayerType
| layerAt: UInt32
Gradient
Examples Usage let x = UIGradient([.Red400, .Red900])
let x = UIGradient(colors: [.Red400,.Red800], start: .top, end: .bottom, locations: nil, cornerEdges: 20, roundEdges: false, style: .axial)
let x = UIGradient(.warmFlame)
let x = UIGradient(.softBlue, cornerEdges: 20)
let x = UIGradient(.softBlue, start: .top, end: .bottom, locations: nil, cornerEdges: 20, roundEdges: false, style: .axial)
Gradient Color
Gradient:
Alert
Show
syntax
Alert: Alert.show(note: String, status: AlertStatus)
Alert.show(note: String, status: AlertStatus, direction: Direction)
Select Status
Success.success
Error .error
Warning.warning
Info .info
Select Direction
Left to Right.ltr
Right to Left .rtl
Alert
Examples Usage var x = UIButton(type: .system)
view.addSubview(x)
x.fillBottom(20, safeArea: true).height(60)
x.addTarget(self, action: #selector(alarto), for: .touchUpInside)
@objc func alarto() {
Alert.show(note: "Welcome to UIKitX", status: .warning)
}
var x = UIButton(type: .system)
{...}
@objc func alarto() {
Alert.show(note: "مرحبا بكم في يو أي كت أكس", status: .success, direction: .rtl)
}