-
Notifications
You must be signed in to change notification settings - Fork 1
/
UIEdgeInsets+Init.swift
44 lines (34 loc) · 1.33 KB
/
UIEdgeInsets+Init.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// UIEdgeInsets+Init.swift
// Lipstick
//
// Created by Filip Dolnik on 16.10.16.
// Copyright © 2016 Brightify. All rights reserved.
//
import UIKit
extension UIEdgeInsets {
public init(left: CGFloat = 0, bottom: CGFloat = 0, right: CGFloat = 0) {
self.init(top: 0, left: left, bottom: bottom, right: right)
}
public init(top: CGFloat, bottom: CGFloat = 0, right: CGFloat = 0) {
self.init(top: top, left: 0, bottom: bottom, right: right)
}
public init(top: CGFloat, left: CGFloat, right: CGFloat = 0) {
self.init(top: top, left: left, bottom: 0, right: right)
}
public init(top: CGFloat, left: CGFloat, bottom: CGFloat) {
self.init(top: top, left: left, bottom: bottom, right: 0)
}
public init(_ all: CGFloat) {
self.init(horizontal: all, vertical: all)
}
public init(horizontal: CGFloat, vertical: CGFloat) {
self.init(top: vertical, left: horizontal, bottom: vertical, right: horizontal)
}
public init(horizontal: CGFloat, top: CGFloat = 0, bottom: CGFloat = 0) {
self.init(top: top, left: horizontal, bottom: bottom, right: horizontal)
}
public init(vertical: CGFloat, left: CGFloat = 0, right: CGFloat = 0) {
self.init(top: vertical, left: left, bottom: vertical, right: right)
}
}