KarimEbrahemAbdelaziz/SwiftyMenu

attributes.roundCorners.cornerValue ?? 0

parthshethi2e opened this issue · 4 comments

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

Same, any updates?

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
  }()

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!

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.