@@ -73,7 +73,8 @@ open class MediaEditor: UINavigationController {
7373 ///
7474 public init ( _ image: UIImage ) {
7575 self . images = [ 0 : image]
76- super. init ( rootViewController: hub)
76+ super. init ( nibName: nil , bundle: nil )
77+ viewControllers = [ hub]
7778 setup ( )
7879 }
7980
@@ -84,7 +85,8 @@ open class MediaEditor: UINavigationController {
8485 ///
8586 public init ( _ images: [ UIImage ] ) {
8687 self . images = images. enumerated ( ) . reduce ( into: [ : ] ) { $0 [ $1. offset] = $1. element }
87- super. init ( rootViewController: hub)
88+ super. init ( nibName: nil , bundle: nil )
89+ viewControllers = [ hub]
8890 setup ( )
8991 }
9092
@@ -96,7 +98,8 @@ open class MediaEditor: UINavigationController {
9698 ///
9799 public init ( _ asyncImage: AsyncImage ) {
98100 self . asyncImages. append ( asyncImage)
99- super. init ( rootViewController: hub)
101+ super. init ( nibName: nil , bundle: nil )
102+ viewControllers = [ hub]
100103 setup ( )
101104 }
102105
@@ -108,24 +111,17 @@ open class MediaEditor: UINavigationController {
108111 ///
109112 public init ( _ asyncImages: [ AsyncImage ] ) {
110113 self . asyncImages = asyncImages
111- super. init ( rootViewController: hub)
114+ super. init ( nibName: nil , bundle: nil )
115+ viewControllers = [ hub]
112116 setup ( )
113117 }
114118
115119 required public init ? ( coder aDecoder: NSCoder ) {
116120 super. init ( coder: aDecoder)
117121 }
118122
119- public override func viewDidLoad( ) {
120- super. viewDidLoad ( )
121-
122- isEditingPlainUIImages = images. count > 0
123-
124- hub. delegate = self
125-
126- modalTransitionStyle = . crossDissolve
127- modalPresentationStyle = . fullScreen
128- navigationBar. isHidden = true
123+ public override init ( nibName nibNameOrNil: String ? , bundle nibBundleOrNil: Bundle ? ) {
124+ super. init ( nibName: nibNameOrNil, bundle: nibBundleOrNil)
129125 }
130126
131127 public override func viewWillDisappear( _ animated: Bool ) {
@@ -140,12 +136,21 @@ open class MediaEditor: UINavigationController {
140136 }
141137
142138 private func setup( ) {
139+ setupModalStyle ( )
143140 setupHub ( )
144141 setupForAsync ( )
145142 presentIfSingleImageAndCapability ( )
146143 }
147144
145+ private func setupModalStyle( ) {
146+ modalTransitionStyle = . crossDissolve
147+ modalPresentationStyle = . fullScreen
148+ navigationBar. isHidden = true
149+ }
150+
148151 private func setupHub( ) {
152+ hub. delegate = self
153+
149154 hub. onCancel = { [ weak self] in
150155 self ? . cancel ( )
151156 }
@@ -166,6 +171,8 @@ open class MediaEditor: UINavigationController {
166171 }
167172
168173 private func setupForAsync( ) {
174+ isEditingPlainUIImages = images. count > 0
175+
169176 asyncImages. enumerated ( ) . forEach { offset, asyncImage in
170177 if let thumb = asyncImage. thumb {
171178 thumbnailAvailable ( thumb, offset: offset)
0 commit comments