Skip to content
This repository has been archived by the owner on Aug 23, 2021. It is now read-only.

Latest commit

 

History

History
185 lines (138 loc) · 3.73 KB

Properties.md

File metadata and controls

185 lines (138 loc) · 3.73 KB

Style properties

Background

  • since: 0.3

  • description: Sets a background to your view (color, gradient and or image)

  • applies: UIView

  • usage:

      style.background = UIColor.redColor()
      style.background = Background(UIImage(named: "bg"), UIColor.orangeGradient())

## Border
- __**since**__: 0.1
- __**description**__: Sets view border color and width
- __**applies**__: `UIView`
- __**usage**__:

  ```swift
    // until 0.7
    style.border = Border(width: 1, color: UIColor.blueColor())

    // after 0.7 you can define one or all borders
    style.border = Border(all: (width: 1, color: UIColor.blue))
    style.border = Border(.left, style: (width: 1, color: UIColor.blue))
    style.border = Border([.left, .right] : (width: 1, color: UIColor.blue))
    ```

## Clip
- __**since**__: 0.4
- __**description**__: enables/disables view overflow clipping
- __**applies**__: `UIView`
- __**default**__: false
- __**usage**__:

 ```swift
   style.clip = true

Color

  • since: 0.1
  • description: Sets text color
  • applies: UILabel
  • usage:
  style.color = UIColor.redColor()

CornerRadius

  • since: 0.4
  • description: Sets view corner radius
  • applies: UIView
  • usage:
  style.corners = Corners(radius: 4)

Font

  • since: 0.1
  • description: Sets text font
  • applies: UILabel
  • usage:
  style.font = UIFont.systemFontOfSize(15)

Height

  • since: 0.7
  • description: Sets a view height using AutoLayout.
  • applies: UIView
  • usage:
 style.height = 42
 style.height = 50 ~ UILayoutPriorityDefaultHigh

Margin

  • since: 0.6
  • description: Sets a view internal margin/padding, i.e. UIView.layoutMargins or UIButton.contentEdgeInsets.
  • applies: UIView, UIButton
  • usage:
  style.margin = UIEdgeInsetsMake(4, 4, 2, 2)
  /// sets UIView.layoutMargins
  /// or UIButton.contentEdgeInsets

MaxHeight

  • since: 0.7
  • description: Sets a view maximum height using AutoLayout.
  • applies: UIView
  • usage:
 style.maxHeight = 42
 style.maxHeight = 50 ~ UILayoutPriorityDefaultHigh

MaxWidth

  • since: 0.7
  • description: Sets a view maximum width using AutoLayout.
  • applies: UIView
  • see: maxHeight

MinHeight

  • since: 0.7
  • description: Sets a view minimum height using AutoLayout.
  • applies: UIView
  • usage:
 style.minHeight = 42
 style.minHeight = 50 ~ UILayoutPriorityDefaultHigh

MinWidth

  • since: 0.7
  • description: Sets a view minimum width using AutoLayout.
  • applies: UIView
  • see: minHeight

Opacity

  • since: 0.4
  • description: Changes view alpha.
  • applies: UIView
  • range: 0 (tranparent) ... 100 (opaque)
  • usage:
  style.opacity = 80

Shadow

  • since: xxx

  • description: Applies shadow to view.

  • applies: UIView

  • usage:

      style.shadow = NSShadow(offset: CGSize(width: 0, height: 0), radius: 4, color: UIColor.red)

TextAlign

TextOverflow

TintColor

Transform

Visible

  • since: 0.1
  • description: Sets whether or not the view is visible by changing hidden property.
  • applies: UIView
  • default: true
  • usage:
  style.visible = false

Width

  • since: 0.7
  • description: Sets a view width using AutoLayout.
  • applies: UIView
  • see: height