Skip to content
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

Add showShadow param for start sequence #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/MaterialShowcase/MaterialShowcase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ extension MaterialShowcase {
}

/// Shows it over current screen after completing setup process
@objc public func show(animated: Bool = true,hasShadow: Bool = true, hasSkipButton: Bool = false, completion handler: (()-> Void)?) {
@objc public func show(animated: Bool = true, hasShadow: Bool = true, hasSkipButton: Bool = false, completion handler: (()-> Void)?) {
initViews()
alpha = 0.0
containerView.addSubview(self)
Expand Down
100 changes: 50 additions & 50 deletions Sources/MaterialShowcase/MaterialShowcaseSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,59 +9,59 @@
import Foundation

public class MaterialShowcaseSequence {

var showcaseArray : [MaterialShowcase] = []
var currentCase : Int = 0
var key : String?

public init() { }

public func temp(_ showcase: MaterialShowcase) -> MaterialShowcaseSequence {
showcaseArray.append(showcase)
return self
}
public func start() {
guard !getUserState(key: self.key) else {
return
var showShadow: Bool = false
var showcaseArray : [MaterialShowcase] = []
var currentCase : Int = 0
var key : String?

public init() { }

public func temp(_ showcase: MaterialShowcase) -> MaterialShowcaseSequence {
showcaseArray.append(showcase)
return self
}
showcaseArray.first?.show(completion: increase)
}
func increase() -> Void {
self.currentCase += 1
}

/// Set user show retry
public func setKey(key : String? = nil) -> MaterialShowcaseSequence {
guard key != nil else {
return self
public func start() {
guard !getUserState(key: self.key) else {
return
}
showcaseArray.first?.show(hasShadow: showShadow, completion: increase)
}
self.key = key
return self
}

/// Remove user state
public func removeUserState(key : String = MaterialKey._default.rawValue) {
UserDefaults.standard.removeObject(forKey: key)
}
/// Remove user state
func getUserState(key : String?) -> Bool {
guard key != nil else {
return false
func increase() -> Void {
self.currentCase += 1
}
return UserDefaults.standard.bool(forKey: key!)
}

public func showCaseWillDismis() {
guard self.showcaseArray.count > currentCase else {
//last index
guard self.key != nil else {
return
}
UserDefaults.standard.set(true, forKey: key!)
return

/// Set user show retry
public func setKey(key : String? = nil) -> MaterialShowcaseSequence {
guard key != nil else {
return self
}
self.key = key
return self
}
showcaseArray[currentCase].show(completion: self.increase)
}


/// Remove user state
public func removeUserState(key : String = MaterialKey._default.rawValue) {
UserDefaults.standard.removeObject(forKey: key)
}
/// Remove user state
func getUserState(key : String?) -> Bool {
guard key != nil else {
return false
}
return UserDefaults.standard.bool(forKey: key!)
}

public func showCaseWillDismis() {
guard self.showcaseArray.count > currentCase else {
//last index
guard self.key != nil else {
return
}
UserDefaults.standard.set(true, forKey: key!)
return
}
showcaseArray[currentCase].show(hasShadow: showShadow, completion: self.increase)
}

}