twho / useful-extensions-ios

A collection of useful iOS extensions in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Useful Extensions in Swift

Generic badge Generic badge

NSObject

var appDelegate: UIApplicationDelegate { get }

UIApplication

public func setStatusBarBackgroundColor(_ color: UIColor)

UIImageView

public func colored(color: UIColor?)

UISlider

public func setThumbImage(_ image: UIImage?)

NSLayoutConstraint

public func changeConstant(_ constant: CGFloat)

StringProtocol

public func index(of string: Self, options: String.CompareOptions = []) -> Index?

UILabel

public convenience init(title: String, size: CGFloat, bold: Bool = true, color: UIColor, numOfLines: Int = 1, alignment: NSTextAlignment = .center)

UITableView

public func reloadDataWithAnimation()

UIView

public var heightConstraint: NSLayoutConstraint? { get }

public var widthConstraint: NSLayoutConstraint? { get }

public func setAnchors(top: UIView? = nil, bottom: UIView? = nil, left: UIView? = nil, right: UIView? = nil)

public func setConstraintsToView(top: UIView? = nil, tConst: CGFloat = 0, bottom: UIView? = nil, bConst: CGFloat = 0, left: UIView? = nil, lConst: CGFloat = 0, right: UIView? = nil, rConst: CGFloat = 0)

public func centerSubView(_ view: UIView)

public func setSquareUsingWidthReference()

public func setSquarUsignHeightReference()

public func setHeightByAspectRatio(_ ratio: CGFloat)

public func setHeightConstraint(_ height: CGFloat)

public func setWidthConstraint(_ width: CGFloat)

public func alignCenter(to view: UIView)

public convenience init(color: UIColor)

public func setCornerBorder(color: UIColor? = nil, cornerRadius: CGFloat = 12.0, borderWidth: CGFloat = 1.5)

public func setCircular(color: UIColor? = nil, borderWidth: CGFloat = 5.0)

public func setBlurredBorder(shadowRadius: CGFloat = 15.0, inset: CGFloat = 10, corner: CGFloat = 10)

public func addSubViews(_ views: [UIView])

public func removeSubviews()

public func setAsShadow(bounds: CGRect, cornerRadius: CGFloat = 0.0, shadowRadius: CGFloat = 1)

public func getZeroHeightConstraint(attachToView: UIView) -> NSLayoutConstraint

public func addGestureRecognizers(_ recognizers: [UIGestureRecognizer], _ delegate: UIGestureRecognizerDelegate)

public func addBlurryEffect(_ style: UIBlurEffect.Style = .light)

UIButton

public func setImage(_ image: UIImage?)

public func setTitle(_ text: String?)

public func setTitleImageSpacing(spacing: CGFloat, imgPadding: CGFloat = 0.0)

UIColor

public func getColorTint() -> UIColor

UIImage

public convenience init?(color: UIColor, size: CGSize = CGSize(width: 1, height: 1))

public func colored(_ color: UIColor?) -> UIImage?

public var aspectRatio: CGFloat

public func isContentEqualTo(_ anotherImage: UIImage) -> Bool

public func cropToWideRatio() -> UIImage?

UIStackView

public convenience init(arrangedSubviews: [UIView]? = nil, axis: NSLayoutConstraint.Axis, distribution: UIStackView.Distribution, spacing: CGFloat)

public func removeAllSubviews()

UIViewController

public var isViewVisible: Bool { get }

public var cellReuseIdentifier: String { get } 

public func hideKeyboardWhenTappedAround()

public func addKeyboardViewMoveListeners()

public func addNavigationBar(title: String, leftBarItem: UIBarButtonItem? = nil, rightBarItem: UIBarButtonItem? = nil, titleColor: UIColor = .white, backgroundColor: UIColor = .black) -> UINavigationBar

@objc public func backToPreviousVC()

public func presentInFullscreen(_ vc: UIViewController, _ animated: Bool = true)

public func runInAnimation(_ function: @escaping (()->()), completion: ((Bool) -> Void)? = nil)

About

A collection of useful iOS extensions in Swift

License:MIT License


Languages

Language:Swift 100.0%