Skip to content

Commit 54e23e7

Browse files
committed
Merge pull request velikanov#11 from jmnavarro/customize_nib
New init arguments to allow different nib name
2 parents b3c6f89 + 46cd39f commit 54e23e7

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

PasscodeLock/PasscodeLockViewController.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,16 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg
4848

4949
// MARK: - Initializers
5050

51-
public init(state: PasscodeLockStateType, configuration: PasscodeLockConfigurationType, animateOnDismiss: Bool = true) {
51+
public init(state: PasscodeLockStateType, configuration: PasscodeLockConfigurationType, animateOnDismiss: Bool = true, nibName: String = "PasscodeLockView", bundle: NSBundle? = nil) {
5252

5353
self.animateOnDismiss = animateOnDismiss
5454

5555
passcodeConfiguration = configuration
5656
passcodeLock = PasscodeLock(state: state, configuration: configuration)
5757

58-
let nibName = "PasscodeLockView"
59-
let bundle: NSBundle = bundleForResource(nibName, ofType: "nib")
58+
let bundleToUse = bundle ?? bundleForResource(nibName, ofType: "nib")
6059

61-
super.init(nibName: nibName, bundle: bundle)
60+
super.init(nibName: nibName, bundle: bundleToUse)
6261

6362
passcodeLock.delegate = self
6463
notificationCenter = NSNotificationCenter.defaultCenter()

0 commit comments

Comments
 (0)