Created
April 21, 2016 21:54
-
-
Save mbbischoff/4b371f0d2a63fcd3dfc71d80b1290139 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class ImmovableView: UIView { | |
/// `true` if setting the receiver’s frame should affect the view’s position and size. `false` if the view should be locked in place. Defaults to `true`. | |
var canMove = true | |
override var frame: CGRect { | |
get { | |
return super.frame | |
} | |
set { | |
guard canMove else { return } | |
super.frame = newValue | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment