Created
May 19, 2016 13:07
-
-
Save clichedmoog/93a51b263b15286e9b6f249074f4dd24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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