UIKitX 0.1.10

UIKitX 0.1.10

Maintained by Ali AlNaghmoush.



UIKitX 0.1.10

  • By
  • alialnaghmoush

Welcome to UIKitX, a UI/UX framework easy & powerful for human use to create beautiful applications.

Language: Swift 2, 3, 4 and 5 Platform Release License

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

UIKitX is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'UIKitX', '~> 0.1.10'

Usage

Import UIKitX module

import UIKitX

Easy

Easy: border syntax

border(width: CGFloat, color: UIColor)
border(width: CGFloat, color: UIColor, views: UIView...)

Examples Usage border

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)

Easy: borderWidth syntax

borderWidth(_ set: CGFloat)
borderWidth(_ set: CGFloat, views: UIView...)

Examples Usage borderWidth

let x = UIView()
x.borderWidth(5)
let x1 = UIView()
let x2 = UIView()
let x3 = UIView()

x1.borderWidth(5, views: x2,x3)

Easy: borderColor syntax

borderColor(_ set: UIColor)
borderColor(_ set: UIColor, views: UIView...)

Examples Usage borderColor

let x = UIView()
x.borderColor(.purple)
let x1 = UIView()
let x2 = UIView()
let x3 = UIView()

x1.borderColor(.white, views: x2,x3)

Easy: cornerEdges syntax

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

Examples Usage cornerEdges

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)

Easy: maskedCorners syntax

maskedCorners(_ set: CACornerMask)
maskedCorners(_ set: CACornerMask, views: UIView...)

Select one or more

.top | .left | .right | .bottom | .topRight | .topLeft | .bottomRight | .bottomLeft

Examples Usage maskedCorners

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)

Easy: maskView syntax

maskView(_ active: Bool) // Active as default is true
maskView(_ active: Bool = true, views: UIView...) // Active as default is true

Examples Usage maskView

let x = UIView()
x.maskView()
let x = UIView()
x.maskView(true, views: x2,x3)

Easy: clipView syntax

clipView(_ active: Bool) // Active as default is true
clipView(_ active: Bool, views: UIView...) // Active as default is true

Examples Usage clipView

let x = UIView()
x.clipView()
let x = UIView()
x.clipView(false, views: x2,x3)

Easy: backColor syntax

backColor(_ set: UIColor)
backColor(_ set: UIColor, views: UIView...)

Examples Usage backColor

let x = UIView()
x.backColor(.white)
let x1 = UIView()
let x2 = UIView()
let x3 = UIView()

x1.backColor(.purple, views: x2,x3)

Easy: addSubviews syntax

addSubviews(_ views: UIView...)

Examples Usage addSubviews

let x1 = UIView()
let x2 = UIView()
let x3 = UIView()

view.addSubviews(x1,x2,x3)

Easy: parallax syntax

parallax(_ set: CGFloat)
parallax(min: CGFloat, max: CGFloat)
parallax(_ strength: ParallaxStrength)

Select Strength

.ExtraLow | .Low | .Mid | .High | .ExtraHigh

Examples Usage parallax

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)

Easy: shadow syntax

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

Examples Usage shadow

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

Color: convenience UIColor syntax

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)

Examples Usage convenience UIColor

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)

Color: hexColor syntax

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

Examples Usage hexColor

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))

Color: materialColor syntax

UIColor.materialColor

Examples Usage hexColor

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

Gradient: Initializers syntax

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)

Gradient: Properties

colors: [UIColor] | start: AxesPoint | end: AxesPoint | locations: [NSNumber]? | cornerEdges: CGFloat | roundEdges: Bool | style: CAGradientLayerType | layerAt: UInt32

Examples Usage Gradient

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: Gradient Color

Alert

Alert: Show syntax

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

Examples Usage Alert

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)
        
    }