Created
February 22, 2020 20:23
-
-
Save alldne/a08181f8300e53df20c17ed5bcc4ebcc to your computer and use it in GitHub Desktop.
ContentSizeView.swift
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
class ContentSizeView: UIView { | |
override var intrinsicContentSize: CGSize { | |
return contentSize ?? CGSize(width: UIView.noIntrinsicMetric, height: UIView.noIntrinsicMetric) | |
} | |
var contentSize: CGSize? { | |
didSet { | |
invalidateIntrinsicContentSize() | |
} | |
} | |
init(frame: CGRect, contentSize: CGSize?) { | |
super.init(frame: frame) | |
self.contentSize = contentSize | |
} | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment