From b9f9c29846d055ae67ce44ca1fb062cf15f2e98b Mon Sep 17 00:00:00 2001 From: Ivan Vorobei Date: Tue, 15 Feb 2022 16:18:01 +0300 Subject: [PATCH] Updated avatar view appearance. --- NativeUIKit.podspec | 2 +- Package.swift | 15 ++----- ...Button.swift => CellProvider+Button.swift} | 0 ...r+Empty.swift => CellProvider+Empty.swift} | 0 ...r.swift => CellProvider+LargeHeader.swift} | 0 .../NativeUIKit/Views/NativeAvatarView.swift | 41 ++++++++++++++++--- 6 files changed, 39 insertions(+), 19 deletions(-) rename Sources/NativeUIKit/Table/Button/{SPDiffableTableCellProvider+Button.swift => CellProvider+Button.swift} (100%) rename Sources/NativeUIKit/Table/Empty/{SPDiffableTableCellProvider+Empty.swift => CellProvider+Empty.swift} (100%) rename Sources/NativeUIKit/Table/LargeHeader/{SPDiffableTableCellProvider+LargeHeader.swift => CellProvider+LargeHeader.swift} (100%) diff --git a/NativeUIKit.podspec b/NativeUIKit.podspec index 5e73218..22394a0 100644 --- a/NativeUIKit.podspec +++ b/NativeUIKit.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'NativeUIKit' - s.version = '1.3.7' + s.version = '1.3.8' s.summary = 'Mimicrated views and controls to native Apple appearance.' s.homepage = 'https://github.com/ivanvorobei/NativeUIKit' s.source = { :git => 'https://github.com/ivanvorobei/NativeUIKit.git', :tag => s.version } diff --git a/Package.swift b/Package.swift index 3affacb..265275a 100644 --- a/Package.swift +++ b/Package.swift @@ -15,18 +15,9 @@ let package = Package( ) ], dependencies: [ - .package( - name: "SparrowKit", - url: "https://github.com/ivanvorobei/SparrowKit", .upToNextMajor(from: "3.5.6") - ), - .package( - name: "SPPerspective", - url: "https://github.com/ivanvorobei/SPPerspective", .upToNextMajor(from: "1.4.1") - ), - .package( - name: "SPDiffable", - url: "https://github.com/ivanvorobei/SPDiffable", .upToNextMajor(from: "4.0.6") - ) + .package(url: "https://github.com/ivanvorobei/SparrowKit", .upToNextMajor(from: "3.5.6")), + .package(url: "https://github.com/ivanvorobei/SPPerspective", .upToNextMajor(from: "1.4.1")), + .package(url: "https://github.com/ivanvorobei/SPDiffable", .upToNextMajor(from: "4.0.6")) ], targets: [ .target( diff --git a/Sources/NativeUIKit/Table/Button/SPDiffableTableCellProvider+Button.swift b/Sources/NativeUIKit/Table/Button/CellProvider+Button.swift similarity index 100% rename from Sources/NativeUIKit/Table/Button/SPDiffableTableCellProvider+Button.swift rename to Sources/NativeUIKit/Table/Button/CellProvider+Button.swift diff --git a/Sources/NativeUIKit/Table/Empty/SPDiffableTableCellProvider+Empty.swift b/Sources/NativeUIKit/Table/Empty/CellProvider+Empty.swift similarity index 100% rename from Sources/NativeUIKit/Table/Empty/SPDiffableTableCellProvider+Empty.swift rename to Sources/NativeUIKit/Table/Empty/CellProvider+Empty.swift diff --git a/Sources/NativeUIKit/Table/LargeHeader/SPDiffableTableCellProvider+LargeHeader.swift b/Sources/NativeUIKit/Table/LargeHeader/CellProvider+LargeHeader.swift similarity index 100% rename from Sources/NativeUIKit/Table/LargeHeader/SPDiffableTableCellProvider+LargeHeader.swift rename to Sources/NativeUIKit/Table/LargeHeader/CellProvider+LargeHeader.swift diff --git a/Sources/NativeUIKit/Views/NativeAvatarView.swift b/Sources/NativeUIKit/Views/NativeAvatarView.swift index 91a2e19..6719f5a 100644 --- a/Sources/NativeUIKit/Views/NativeAvatarView.swift +++ b/Sources/NativeUIKit/Views/NativeAvatarView.swift @@ -89,12 +89,41 @@ open class NativeAvatarView: SPView { } } - open var placeholderImage = UIImage.system("person.crop.circle.fill", font: .systemFont(ofSize: 80, weight: .medium)) - open var placeholderColorise = SPDimmedButton.Colorise.init(content: .init(light: .systemGray3, dark: .systemGray2), background: .clear) - open var indicatorAddImage = UIImage.system("plus", font: .preferredFont(forTextStyle: .title3, weight: .bold)) - open var indicatorAddColorise = SPDimmedButton.Colorise.init(content: .white, background: .systemGreen) - open var indicatorEditImage = UIImage.system("pencil", font: .preferredFont(forTextStyle: .title3, weight: .bold)) - open var indicatorEditColorise = SPDimmedButton.Colorise.init(content: .white, background: .systemBlue) + open var placeholderImage = UIImage.system("person.crop.circle.fill", font: .systemFont(ofSize: 80, weight: .medium)) { + didSet { + placeholderButton.setImage(placeholderImage) + } + } + + open var placeholderColorise = SPDimmedButton.Colorise.init(content: .init(light: .systemGray3, dark: .systemGray2), background: .clear) { + didSet { + placeholderButton.applyDefaultAppearance(with: placeholderColorise) + } + } + + open var indicatorAddImage = UIImage.system("plus", font: .preferredFont(forTextStyle: .title3, weight: .bold)) { + didSet { + updateEditAppearance() + } + } + + open var indicatorAddColorise = SPDimmedButton.Colorise.init(content: .white, background: .systemGreen) { + didSet { + updateEditAppearance() + } + } + + open var indicatorEditImage = UIImage.system("pencil", font: .preferredFont(forTextStyle: .title3, weight: .bold)) { + didSet { + updateEditAppearance() + } + } + + open var indicatorEditColorise = SPDimmedButton.Colorise.init(content: .white, background: .systemBlue) { + didSet { + updateEditAppearance() + } + } // MARK: - Init