File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed
Sources/NativeUIKit/Views Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 11Pod ::Spec . new do |s |
22
33 s . name = 'NativeUIKit'
4- s . version = '1.3.8 '
4+ s . version = '1.3.9 '
55 s . summary = 'Mimicrated views and controls to native Apple appearance.'
66 s . homepage = 'https://github.com/ivanvorobei/NativeUIKit'
77 s . source = { :git => 'https://github.com/ivanvorobei/NativeUIKit.git' , :tag => s . version }
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ open class NativeAvatarView: SPView {
8989 }
9090 }
9191
92- open var placeholderImage = UIImage . system ( " person.crop.circle.fill " , font : . systemFont ( ofSize : 80 , weight : . medium) ) {
92+ open var placeholderImage = generatePlaceholderImage ( fontSize : 80 , fontWeight : . medium) {
9393 didSet {
9494 placeholderButton. setImage ( placeholderImage)
9595 }
@@ -164,10 +164,23 @@ open class NativeAvatarView: SPView {
164164 placeholderButton. sizeToFit ( )
165165 frame. setWidth ( placeholderButton. frame. width + layoutMargins. left + layoutMargins. right)
166166 layoutSubviews ( )
167- return . init(
168- width: max ( placeholderButton. frame. maxX, indicatorButton. frame. maxX) + layoutMargins. bottom,
169- height: max ( placeholderButton. frame. maxY, indicatorButton. frame. maxY) + layoutMargins. bottom
170- )
167+ if isEditable {
168+ return . init(
169+ width: max ( placeholderButton. frame. maxX, indicatorButton. frame. maxX) + layoutMargins. bottom,
170+ height: max ( placeholderButton. frame. maxY, indicatorButton. frame. maxY) + layoutMargins. bottom
171+ )
172+ } else {
173+ return . init(
174+ width: placeholderButton. frame. maxX + layoutMargins. bottom,
175+ height: placeholderButton. frame. maxY + layoutMargins. bottom
176+ )
177+ }
178+ }
179+
180+ // MARK: - Public
181+
182+ static public func generatePlaceholderImage( fontSize: CGFloat , fontWeight: UIFont . Weight ) -> UIImage {
183+ return UIImage . system ( " person.crop.circle.fill " , font: . systemFont( ofSize: fontSize, weight: fontWeight) )
171184 }
172185
173186 // MARK: - Internal
You can’t perform that action at this time.
0 commit comments