Parchment icon indicating copy to clipboard operation
Parchment copied to clipboard

Crash when init()

Open Ryphnalt opened this issue 3 years ago • 1 comments

Hello, everyone.

I use Parchment in my custom view controller, but it's crash when init().

Parchment version: 3.0.1

Error message is: " Fatal error: Use of unimplemented initializer 'init(nibName:bundle:)' for class 'Parchment.PagingViewController' "

Here is my code:

class ParchmentViewController: UIViewController {
    var pagingViewController = PagingViewController()
    override func viewDidLoad() {
        super.viewDidLoad()
        pagingViewController.delegate = self
        pagingViewController.dataSource = self
    }
}

extension ParchmentViewController: PagingViewControllerDelegate {
    ...
}

extension ParchmentViewController: PagingViewControllerDataSource {
    ...
}

I don't know what happened. Please help me, thanks.

Ryphnalt avatar Nov 11 '21 10:11 Ryphnalt

try calling init with options let pagingViewController = PagingViewController(options: PagingOptions())

nonisolated avatar Sep 23 '22 12:09 nonisolated

Looks like you are trying to initialise it using the init(nibName:bundle:) initialiser. You either need to initialize it from a storyboard or using the default init(options:) initializer.

rechsteiner avatar Mar 07 '23 19:03 rechsteiner