Search code examples
iosswiftnscodinguistepper

"NSCoding is not supported" when trying to use KWStepper custom UI stepper pod


I am using a custom stepper called KWSepper, found on GitHub. I have used the protocol in my table view cell file. When trying to access the table view in a VC I get a fatal error on this line of code from the authored KWStepper swift file:

    public required init?(coder aDecoder: NSCoder) {
        fatalError("KWStepper: NSCoding is not supported!")
    }

Solution

  • That code shows that this custom stepper was never intended to be instantiated from the storyboard. Don't instantiate the stepper from the storyboard! Instantiate it only in code, as intended. Follow the example code on the github site:

    stepper = KWStepper(decrementButton: decrementButton, incrementButton: incrementButton)