0

I am trying to set a button property like this, When i add this code it crashes without even displaying the button i have in the main.storyboard.

 let containerScheme = MDCContainerScheme()
        cancelButton.applyOutlinedTheme(withScheme: containerScheme)

console

2 Answers2

1

I faced the same problem. But I was building the UI through code.

import MaterialComponents.MaterialButtons
import MaterialComponents.MaterialButtons_Theming

let button = MDCButton()
button.applyTextTheme(withScheme: MDCContainerScheme())

The following helped me. I just called the option Product -> Clean Build Folder. After that, the abnormal termination of the program disappeared.

dronpopdev
  • 797
  • 10
  • 13
0

From the error, you can see that UIButton does not have a method called applyOutlinedThemeWithScheme, which could mean that in your storyboard or XIB, you are using a UIButton instead of a MDCButton.

In your storyboard or XIB, go to Identity Inspector, make sure Class is set to MDCButton.

Bill
  • 469
  • 2
  • 4