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

attributes.roundCorners.cornerValue ?? 0 #39

Open
parthshethi2e opened this issue Apr 12, 2023 · 4 comments
Open

attributes.roundCorners.cornerValue ?? 0 #39

parthshethi2e opened this issue Apr 12, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@parthshethi2e
Copy link

layer.cornerRadius = attributes.roundCorners.cornerValue ?? 0

Error on this line: SwiftyMenu/SwiftyMenu.swift:260: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

@HuvosFromDarnassus
Copy link

Same, any updates?

@HuvosFromDarnassus
Copy link

Seems to have solved the problem. It is necessary to fill in all the fields in SwiftyMenuAttributes on your own, in the library code everywhere force-unwrap optional values 😠

private lazy var testDropDown: SwiftyMenu = {
      var dropDownViewAttrebutes = SwiftyMenuAttributes()
      dropDownViewAttrebutes.roundCorners = SwiftyMenuAttributes.RoundCorners.all(radius: 0)  // We initialize manually and so with all other attributes in SwiftyMenuAttributes

      let testDropDown = SwiftyMenu(frame: CGRect(x: 0, y: 0, width: 0, height: 40))
      testDropDown.configure(with: dropDownViewAttrebutes)
      testDropDown.delegate = self
      testDropDown.items = dropDownOptionsDataSource
      testDropDown.translatesAutoresizingMaskIntoConstraints = false
      return testDropDown
  }()

@JidongHe
Copy link

JidongHe commented May 8, 2024

Seems to have solved the problem. It is necessary to fill in all the fields in SwiftyMenuAttributes on your own, in the library code everywhere force-unwrap optional values 😠

private lazy var testDropDown: SwiftyMenu = {
      var dropDownViewAttrebutes = SwiftyMenuAttributes()
      dropDownViewAttrebutes.roundCorners = SwiftyMenuAttributes.RoundCorners.all(radius: 0)  // We initialize manually and so with all other attributes in SwiftyMenuAttributes

      let testDropDown = SwiftyMenu(frame: CGRect(x: 0, y: 0, width: 0, height: 40))
      testDropDown.configure(with: dropDownViewAttrebutes)
      testDropDown.delegate = self
      testDropDown.items = dropDownOptionsDataSource
      testDropDown.translatesAutoresizingMaskIntoConstraints = false
      return testDropDown
  }()

this method is work for me!

@KarimEbrahemAbdelaziz
Copy link
Owner

Hello @parthshethi2e and @HuvosFromDarnassus ,

Sorry for force unwrapping everywhere. I'm going to work on it to make it more safer :)

I'll keep this issue open until I'm done with the refactoring.

Thank you.

@KarimEbrahemAbdelaziz KarimEbrahemAbdelaziz added the bug Something isn't working label May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants