Skip to content

Instantly share code, notes, and snippets.

@clichedmoog
Created May 19, 2016 13:07
Show Gist options
  • Save clichedmoog/93a51b263b15286e9b6f249074f4dd24 to your computer and use it in GitHub Desktop.
Save clichedmoog/93a51b263b15286e9b6f249074f4dd24 to your computer and use it in GitHub Desktop.
//
// UIView.swift
// AirKlass
//
// Created by TENMA on 2016. 5. 19..
// Copyright © 2016년 Quriously. All rights reserved.
//
import UIKit
@IBDesignable extension UIView {
@IBInspectable var cornerRadius:CGFloat {
set {
layer.cornerRadius = newValue
clipsToBounds = newValue > 0
}
get {
return layer.cornerRadius
}
}
@IBInspectable var borderColor:UIColor? {
set {
layer.borderColor = newValue!.CGColor
}
get {
if let color = layer.borderColor {
return UIColor(CGColor:color)
}
else {
return nil
}
}
}
@IBInspectable var borderWidth:CGFloat {
set {
layer.borderWidth = newValue
}
get {
return layer.borderWidth
}
}
@IBInspectable var shadowColor:UIColor? {
set {
layer.shadowColor = newValue!.CGColor
}
get {
if let color = layer.shadowColor {
return UIColor(CGColor:color)
}
else {
return nil
}
}
}
@IBInspectable var shadowOffset:CGSize {
set {
layer.shadowOffset = newValue
}
get {
return layer.shadowOffset
}
}
@IBInspectable var shadowRadius:CGFloat {
set {
layer.shadowRadius = newValue
}
get {
return layer.shadowRadius
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment