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

MaterialShowcase/MaterialShowcase.swift:371: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value #161

Open
HarshParekh03 opened this issue Feb 7, 2024 · 0 comments

Comments

@HarshParekh03
Copy link

I have provided below code where is face crash in containerView function of initViews() and below is how i use in viewDidLoad() and viewWillAppear i also tried setting up in viewdidAppear but still facing the crash. Please help me with a solution as i have already implemented in client project.

let showcase = MaterialShowcase()

self.showcase.setTargetView(button: self.btnLogin)

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.showcase.show {
print("Success")
}
}

func initViews() {
let center = calculateCenter(at: targetView, to: containerView)

addTargetRipple(at: center)
addTargetHolder(at: center)

// if color is not UIColor.clear, then add the target snapshot
if targetHolderColor != .clear {
  addTarget(at: center)
}

addBackground()

addInstructionView(at: center)
instructionView.layoutIfNeeded()

// Disable subview interaction to let users click to general view only
subviews.forEach({$0.isUserInteractionEnabled = false})

if isTapRecognizerForTargetView {
  //Add gesture recognizer for targetCopyView
  hiddenTargetHolderView.addGestureRecognizer(tapGestureRecoganizer())
  hiddenTargetHolderView.isUserInteractionEnabled = true
} else {
  // Add gesture recognizer for both container and its subview
  addGestureRecognizer(tapGestureRecoganizer())
  hiddenTargetHolderView.addGestureRecognizer(tapGestureRecoganizer())
  hiddenTargetHolderView.isUserInteractionEnabled = true
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant