-
Notifications
You must be signed in to change notification settings - Fork 63
Support customisation in Objective-C #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>SchemeUserState</key> | ||
| <dict> | ||
| <key>ARSLineProgress.xcscheme</key> | ||
| <dict> | ||
| <key>orderHint</key> | ||
| <integer>0</integer> | ||
| </dict> | ||
| </dict> | ||
| </dict> | ||
| </plist> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,16 +23,23 @@ public final class ARSLineProgress: NSObject { | |
| Will interrupt the current .Infinite loader progress and show success animation instead. | ||
| */ | ||
| public static func showSuccess() { | ||
| if !statusShown { ARSStatus.show(.success) } | ||
| if !statusShown { ARSStatus.show(.success, title: "") } | ||
| } | ||
|
|
||
| public static func showSuccess(title: NSString) { | ||
| if !statusShown { ARSStatus.show(.success, title: title) } | ||
| } | ||
|
|
||
| /** | ||
| Will interrupt the current .Infinite loader progress and show fail animation instead. | ||
| */ | ||
| public static func showFail() { | ||
| if !statusShown { ARSStatus.show(.fail) } | ||
| if !statusShown { ARSStatus.show(.success, title: "") } | ||
|
||
| } | ||
|
|
||
| public static func showFail(title: NSString) { | ||
| if !statusShown { ARSStatus.show(.success, title: title) } | ||
|
||
| } | ||
|
|
||
| // MARK: Show Infinite Loader | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| // | ||
| // ARSLineProgressCustomizationObjcExt.swift | ||
| // ARSLineProgress | ||
| // | ||
| // Created by Johnnie on 28/02/18. | ||
| // Copyright © 2018 Iaroslav Arsenkin. All rights reserved. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| extension ARSLineProgressConfiguration { | ||
| @objc static func ars_setShowSuccessCheckmark(show : Bool){ | ||
| showSuccessCheckmark = show; | ||
| } | ||
|
|
||
| // MARK: background view | ||
| @objc static func ars_setBackgroundViewDismissTransformScale(scale : CGFloat){ | ||
| backgroundViewDismissTransformScale = scale; | ||
| } | ||
|
|
||
| @objc static func ars_setBackgroundViewColor(color : CGColor){ | ||
| backgroundViewColor = color; | ||
| } | ||
|
|
||
|
|
||
| /// setBackgroundViewStyle | ||
| /// | ||
| /// - Parameter style: 0:blur, 1:simple, 2:full, default:blur | ||
| @objc static func ars_setBackgroundViewStyle(style : NSInteger){ | ||
| switch style { | ||
|
|
||
| case 0: | ||
| backgroundViewStyle = .blur; | ||
| break; | ||
|
|
||
| case 1: | ||
| backgroundViewStyle = .simple; | ||
| break; | ||
|
|
||
| case 2: | ||
| backgroundViewStyle = .full; | ||
| break; | ||
|
|
||
|
|
||
| default: | ||
| backgroundViewStyle = .blur; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| @objc static func ars_setBackgroundViewCornerRadius(radius : CGFloat){ | ||
| backgroundViewCornerRadius = radius; | ||
| } | ||
|
|
||
| @objc static func ars_setBackgroundViewPresentAnimationDuration(duration : CFTimeInterval){ | ||
| backgroundViewPresentAnimationDuration = duration; | ||
| } | ||
|
|
||
| @objc static func ars_setBackgroundViewDismissAnimationDuration(duration : CFTimeInterval){ | ||
| backgroundViewDismissAnimationDuration = duration; | ||
| } | ||
|
|
||
| @objc static func ars_setBlurStyle(style : UIBlurEffectStyle){ | ||
| blurStyle = style; | ||
| } | ||
|
|
||
| // MARK: circles | ||
| @objc static func ars_setcircleColorOuter(color : CGColor){ | ||
| circleColorOuter = color; | ||
| } | ||
|
|
||
| @objc static func ars_setcircleColorMiddle(color : CGColor){ | ||
| circleColorMiddle = color; | ||
| } | ||
|
|
||
| @objc static func ars_setCircleColorInner(color : CGColor){ | ||
| circleColorInner = color; | ||
| } | ||
|
|
||
| @objc static func ars_setCircleRotationDurationOuter(duration : CFTimeInterval){ | ||
| circleRotationDurationOuter = duration; | ||
| } | ||
|
|
||
| @objc static func ars_setCircleRotationDurationMiddle(duration : CFTimeInterval){ | ||
| circleRotationDurationMiddle = duration; | ||
| } | ||
|
|
||
| @objc static func ars_setCircleRotationDurationInner(duration : CFTimeInterval){ | ||
| circleRotationDurationInner = duration; | ||
| } | ||
|
|
||
|
|
||
| // MARK: check mark | ||
| @objc static func ars_setCheckmarkAnimationDrawDuration(duration : CFTimeInterval){ | ||
| checkmarkAnimationDrawDuration = duration; | ||
| } | ||
|
|
||
| @objc static func ars_setCheckmarkLineWidth(width : CGFloat){ | ||
| checkmarkLineWidth = width; | ||
| } | ||
|
|
||
| @objc static func ars_setCheckmarkColor(color : CGColor){ | ||
| checkmarkColor = color; | ||
| } | ||
|
|
||
| // MARK: success circle | ||
| @objc static func ars_setSuccessCircleAnimationDrawDuration(duration : CFTimeInterval){ | ||
| successCircleAnimationDrawDuration = duration; | ||
| } | ||
|
|
||
| @objc static func ars_setSuccessCircleLineWidth(width : CGFloat){ | ||
| successCircleLineWidth = width; | ||
| } | ||
|
|
||
| @objc static func ars_setSuccessCircleColor(color : CGColor){ | ||
| successCircleColor = color; | ||
| } | ||
|
|
||
| // MARK: fail cross | ||
| @objc static func ars_setFailCrossAnimationDrawDuration(duration : CFTimeInterval){ | ||
| failCrossAnimationDrawDuration = duration; | ||
| } | ||
|
|
||
| @objc static func ars_setFailCrossLineWidth(width : CGFloat){ | ||
| failCrossLineWidth = width; | ||
| } | ||
|
|
||
| @objc static func ars_setFailCrossColor(color : CGColor){ | ||
| failCrossColor = color; | ||
| } | ||
|
|
||
| // MARK: fail circel | ||
| @objc static func ars_setFailCircleAnimationDrawDuration(duration : CFTimeInterval){ | ||
| failCircleAnimationDrawDuration = duration; | ||
| } | ||
|
|
||
| @objc static func ars_setFailCircleLineWidth(width : CGFloat){ | ||
| failCircleLineWidth = width; | ||
| } | ||
|
|
||
| @objc static func ars_setFailCircleColor(color : CGColor){ | ||
| failCircleColor = color; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,9 +37,22 @@ func ars_window() -> UIWindow? { | |
| return targetWindow | ||
| } | ||
|
|
||
| @discardableResult func ars_createdFrameForBackgroundView(_ backgroundView: UIView, onView view: UIView?) -> Bool { | ||
| func sizeForTitle(_ title : NSString?) -> CGSize{ | ||
| if title != nil{ | ||
|
||
| return title!.boundingRect(with:CGSize(width:0, height:0), | ||
| options:NSStringDrawingOptions.usesLineFragmentOrigin, | ||
| attributes:[NSFontAttributeName: UIFont.systemFont(ofSize: ARS_TITLE_SIZE)], | ||
| context:nil) | ||
| .size | ||
| } | ||
|
|
||
| return CGSize(width:0, height:0) | ||
| } | ||
|
|
||
| @discardableResult func ars_createdFrameForBackgroundView(_ backgroundView: UIView, title: NSString?, onView view: UIView?) -> Bool { | ||
| let center: CGPoint | ||
| let bounds: CGRect | ||
| let lbSize = sizeForTitle(title) | ||
|
|
||
| if view == nil { | ||
| guard let window = ars_window() else { return false } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the formatting the same way it was before.