Skip to content

Commit

Permalink
Add indicator view color property. (#17)
Browse files Browse the repository at this point in the history
* Add indicator view color property.

* Review

* Cleanup

* Update deployment target to iOS 13
  • Loading branch information
ntnmrndn authored Jul 27, 2022
1 parent 30b1c3a commit 2a63be9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion GlossButtonNode.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
spec.homepage = "https://github.com/TextureCommunity/GlossButtonNode"
spec.license = "MIT"
spec.author = "muukii", "yukkobay"
spec.platform = :ios, "10.0"
spec.platform = :ios, "13.0"
spec.source = { :git => "https://github.com/TextureCommunity/GlossButtonNode.git", :tag => "#{spec.version}" }
spec.source_files = "GlossButtonNode", "GlossButtonNode/**/*.swift"

Expand Down
6 changes: 6 additions & 0 deletions GlossButtonNode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@
8BE6C91463AA30AD4B282C45 /* Pods */,
813110C4657D241717B7020E /* Frameworks */,
);
indentWidth = 2;
sourceTree = "<group>";
tabWidth = 2;
};
4B6F6F472452A1FA00B6CC3A /* Products */ = {
isa = PBXGroup;
Expand Down Expand Up @@ -546,6 +548,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
GENERATE_INFOPLIST_FILE = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -572,6 +575,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
GENERATE_INFOPLIST_FILE = YES;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -592,6 +596,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "Demo-GlossButtonNode/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -610,6 +615,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = "Demo-GlossButtonNode/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
18 changes: 14 additions & 4 deletions GlossButtonNode/GlossButtonDescriptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ import CoreGraphics
Configurations for creating ``GlossButtonNode``
*/
public struct GlossButtonDescriptor {

public struct ActivityIndicatorStyle {
public let color: UIColor
public let style: UIActivityIndicatorView.Style

public init(color: UIColor = .white, style: UIActivityIndicatorView.Style = .medium) {
self.color = color
self.style = style
}
}

public var image: UIImage?
public var imageTintColor: UIColor?
Expand All @@ -41,9 +51,9 @@ public struct GlossButtonDescriptor {
public var bodyStyle: GlossButtonBodyStyle
public var surfaceStyle: GlossButtonSurfaceStyle

public var indicatorViewStyle: UIActivityIndicatorView.Style
public var activityIndicatorStyle: ActivityIndicatorStyle
public var bodyOpacity: CGFloat

public init(
title: NSAttributedString? = nil,
image: UIImage? = nil,
Expand All @@ -53,7 +63,7 @@ public struct GlossButtonDescriptor {
surfaceStyle: GlossButtonSurfaceStyle,
bodyOpacity: CGFloat = 1,
insets: UIEdgeInsets? = nil,
indicatorViewStyle: UIActivityIndicatorView.Style = .white
activityIndicatorStyle: ActivityIndicatorStyle = .init()
) {

self.title = title
Expand All @@ -66,7 +76,7 @@ public struct GlossButtonDescriptor {
self.truncateStyle = truncateStyle
self.surfaceStyle = surfaceStyle
self.bodyStyle = bodyStyle
self.indicatorViewStyle = indicatorViewStyle
self.activityIndicatorStyle = activityIndicatorStyle
}

}
Expand Down
7 changes: 5 additions & 2 deletions GlossButtonNode/GlossButtonNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ public final class GlossButtonNode : ASControlNode {
self.prepareLoadingIndicatorIfNeeded()

self._isProcessing = newValue

self.indicator.style = self.currentDescriptor?.indicatorViewStyle ?? .white

let indicatorDesctiptor: GlossButtonDescriptor.ActivityIndicatorStyle = self.currentDescriptor?.activityIndicatorStyle ?? .init()

self.indicator.style = indicatorDesctiptor.style
self.indicator.color = indicatorDesctiptor.color

UIView.animate(withDuration: 0.2, delay: 0, options: [], animations: {

Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 0c7037576bc407bdef19696a47ec9b37689598a1

COCOAPODS: 1.11.3
COCOAPODS: 1.11.2

0 comments on commit 2a63be9

Please sign in to comment.