Best Swift-snapshot-testing code snippet using ViewController.viewWillDisappear
SceneN.generated.swift
Source:SceneN.generated.swift
...110 viewController.didAppear = { [weak e1] animated in111 if let observer = e1 as? ViewObserver { observer.viewDidAppear(animated) }112 }113 viewController.willDisappear = { [weak e1] animated in114 if let observer = e1 as? ViewObserver { observer.viewWillDisappear(animated) }115 }116 viewController.didDisappear = { [weak e1] animated in117 if let observer = e1 as? ViewObserver { observer.viewDidDisappear(animated) }118 }119 viewController.willLayoutSubviews = { [weak e1] in120 if let observer = e1 as? ViewObserver { observer.viewWillLayoutSubviews() }121 }122 viewController.didLayoutSubviews = { [weak e1] in123 if let observer = e1 as? ViewObserver { observer.viewDidLayoutSubviews() }124 }125 }126 private func awake(_ viewController: ViewController, _ e1: E1) {127 if let awakable = viewController as? Awakable { awakable.awake() }128 if let awakable = e1 as? Awakable { awakable.awake() }129 }130}131public struct Scene2<ViewController: UIViewController, E1: AnyObject, E2: AnyObject> {132 let viewController: () -> ViewController133 let e1: () -> E1134 let e2: () -> E2135}136extension Scene2 {137 public func with<E3>(_ e3: @escaping () -> E3) -> Scene3<ViewController, E1, E2, E3> {138 return Scene3(viewController: viewController, e1: e1, e2: e2, e3: e3)139 }140}141extension Scene2 {142 public func instantiate() -> ViewController {143 let viewController = self.viewController()144 let e1 = self.e1()145 let e2 = self.e2()146 viewController.extras = (e1, e2)147 addViewObservers(viewController, e1, e2)148 awake(viewController, e1, e2)149 return viewController150 }151 public func instantiate(connect: (ViewController, E1, E2) -> Void) -> ViewController {152 let viewController = self.viewController()153 let e1 = self.e1()154 let e2 = self.e2()155 viewController.extras = (e1, e2)156 addViewObservers(viewController, e1, e2)157 connect(viewController, e1, e2)158 awake(viewController, e1, e2)159 return viewController160 }161 public func instantiate(view: @escaping (ViewController, E1, E2) -> UIView) -> ViewController {162 let viewController = self.viewController()163 let e1 = self.e1()164 let e2 = self.e2()165 viewController.extras = (e1, e2)166 addViewObservers(viewController, e1, e2)167 addViewBuilder(view, viewController, e1, e2)168 awake(viewController, e1, e2)169 return viewController170 }171 public func instantiate(connect: (ViewController, E1, E2) -> Void, view: @escaping (ViewController, E1, E2) -> UIView) -> ViewController {172 let viewController = self.viewController()173 let e1 = self.e1()174 let e2 = self.e2()175 viewController.extras = (e1, e2)176 addViewObservers(viewController, e1, e2)177 addViewBuilder(view, viewController, e1, e2)178 connect(viewController, e1, e2)179 awake(viewController, e1, e2)180 return viewController181 }182 private func addViewBuilder<View: UIView>(_ view: @escaping (ViewController, E1, E2) -> View, _ viewController: ViewController, _ e1: E1, _ e2: E2) {183 viewController.viewBuilder = { [weak viewController, weak e1, weak e2] in184 guard let viewController = viewController, let e1 = e1, let e2 = e2 else {185 return View()186 }187 return view(viewController, e1, e2)188 }189 }190 private func addViewObservers(_ viewController: ViewController, _ e1: E1, _ e2: E2) {191 viewController.didLoad = { [weak e1, weak e2] in192 if let observer = e1 as? ViewObserver { observer.viewDidLoad() }193 if let observer = e2 as? ViewObserver { observer.viewDidLoad() }194 }195 viewController.willAppear = { [weak e1, weak e2] animated in196 if let observer = e1 as? ViewObserver { observer.viewWillAppear(animated) }197 if let observer = e2 as? ViewObserver { observer.viewWillAppear(animated) }198 }199 viewController.didAppear = { [weak e1, weak e2] animated in200 if let observer = e1 as? ViewObserver { observer.viewDidAppear(animated) }201 if let observer = e2 as? ViewObserver { observer.viewDidAppear(animated) }202 }203 viewController.willDisappear = { [weak e1, weak e2] animated in204 if let observer = e1 as? ViewObserver { observer.viewWillDisappear(animated) }205 if let observer = e2 as? ViewObserver { observer.viewWillDisappear(animated) }206 }207 viewController.didDisappear = { [weak e1, weak e2] animated in208 if let observer = e1 as? ViewObserver { observer.viewDidDisappear(animated) }209 if let observer = e2 as? ViewObserver { observer.viewDidDisappear(animated) }210 }211 viewController.willLayoutSubviews = { [weak e1, weak e2] in212 if let observer = e1 as? ViewObserver { observer.viewWillLayoutSubviews() }213 if let observer = e2 as? ViewObserver { observer.viewWillLayoutSubviews() }214 }215 viewController.didLayoutSubviews = { [weak e1, weak e2] in216 if let observer = e1 as? ViewObserver { observer.viewDidLayoutSubviews() }217 if let observer = e2 as? ViewObserver { observer.viewDidLayoutSubviews() }218 }219 }220 private func awake(_ viewController: ViewController, _ e1: E1, _ e2: E2) {221 if let awakable = viewController as? Awakable { awakable.awake() }222 if let awakable = e1 as? Awakable { awakable.awake() }223 if let awakable = e2 as? Awakable { awakable.awake() }224 }225}226public struct Scene3<ViewController: UIViewController, E1: AnyObject, E2: AnyObject, E3: AnyObject> {227 let viewController: () -> ViewController228 let e1: () -> E1229 let e2: () -> E2230 let e3: () -> E3231}232extension Scene3 {233 public func with<E4>(_ e4: @escaping () -> E4) -> Scene4<ViewController, E1, E2, E3, E4> {234 return Scene4(viewController: viewController, e1: e1, e2: e2, e3: e3, e4: e4)235 }236}237extension Scene3 {238 public func instantiate() -> ViewController {239 let viewController = self.viewController()240 let e1 = self.e1()241 let e2 = self.e2()242 let e3 = self.e3()243 viewController.extras = (e1, e2, e3)244 addViewObservers(viewController, e1, e2, e3)245 awake(viewController, e1, e2, e3)246 return viewController247 }248 public func instantiate(connect: (ViewController, E1, E2, E3) -> Void) -> ViewController {249 let viewController = self.viewController()250 let e1 = self.e1()251 let e2 = self.e2()252 let e3 = self.e3()253 viewController.extras = (e1, e2, e3)254 addViewObservers(viewController, e1, e2, e3)255 connect(viewController, e1, e2, e3)256 awake(viewController, e1, e2, e3)257 return viewController258 }259 public func instantiate(view: @escaping (ViewController, E1, E2, E3) -> UIView) -> ViewController {260 let viewController = self.viewController()261 let e1 = self.e1()262 let e2 = self.e2()263 let e3 = self.e3()264 viewController.extras = (e1, e2, e3)265 addViewObservers(viewController, e1, e2, e3)266 addViewBuilder(view, viewController, e1, e2, e3)267 awake(viewController, e1, e2, e3)268 return viewController269 }270 public func instantiate(connect: (ViewController, E1, E2, E3) -> Void, view: @escaping (ViewController, E1, E2, E3) -> UIView) -> ViewController {271 let viewController = self.viewController()272 let e1 = self.e1()273 let e2 = self.e2()274 let e3 = self.e3()275 viewController.extras = (e1, e2, e3)276 addViewObservers(viewController, e1, e2, e3)277 addViewBuilder(view, viewController, e1, e2, e3)278 connect(viewController, e1, e2, e3)279 awake(viewController, e1, e2, e3)280 return viewController281 }282 private func addViewBuilder<View: UIView>(_ view: @escaping (ViewController, E1, E2, E3) -> View, _ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3) {283 viewController.viewBuilder = { [weak viewController, weak e1, weak e2, weak e3] in284 guard let viewController = viewController, let e1 = e1, let e2 = e2, let e3 = e3 else {285 return View()286 }287 return view(viewController, e1, e2, e3)288 }289 }290 private func addViewObservers(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3) {291 viewController.didLoad = { [weak e1, weak e2, weak e3] in292 if let observer = e1 as? ViewObserver { observer.viewDidLoad() }293 if let observer = e2 as? ViewObserver { observer.viewDidLoad() }294 if let observer = e3 as? ViewObserver { observer.viewDidLoad() }295 }296 viewController.willAppear = { [weak e1, weak e2, weak e3] animated in297 if let observer = e1 as? ViewObserver { observer.viewWillAppear(animated) }298 if let observer = e2 as? ViewObserver { observer.viewWillAppear(animated) }299 if let observer = e3 as? ViewObserver { observer.viewWillAppear(animated) }300 }301 viewController.didAppear = { [weak e1, weak e2, weak e3] animated in302 if let observer = e1 as? ViewObserver { observer.viewDidAppear(animated) }303 if let observer = e2 as? ViewObserver { observer.viewDidAppear(animated) }304 if let observer = e3 as? ViewObserver { observer.viewDidAppear(animated) }305 }306 viewController.willDisappear = { [weak e1, weak e2, weak e3] animated in307 if let observer = e1 as? ViewObserver { observer.viewWillDisappear(animated) }308 if let observer = e2 as? ViewObserver { observer.viewWillDisappear(animated) }309 if let observer = e3 as? ViewObserver { observer.viewWillDisappear(animated) }310 }311 viewController.didDisappear = { [weak e1, weak e2, weak e3] animated in312 if let observer = e1 as? ViewObserver { observer.viewDidDisappear(animated) }313 if let observer = e2 as? ViewObserver { observer.viewDidDisappear(animated) }314 if let observer = e3 as? ViewObserver { observer.viewDidDisappear(animated) }315 }316 viewController.willLayoutSubviews = { [weak e1, weak e2, weak e3] in317 if let observer = e1 as? ViewObserver { observer.viewWillLayoutSubviews() }318 if let observer = e2 as? ViewObserver { observer.viewWillLayoutSubviews() }319 if let observer = e3 as? ViewObserver { observer.viewWillLayoutSubviews() }320 }321 viewController.didLayoutSubviews = { [weak e1, weak e2, weak e3] in322 if let observer = e1 as? ViewObserver { observer.viewDidLayoutSubviews() }323 if let observer = e2 as? ViewObserver { observer.viewDidLayoutSubviews() }324 if let observer = e3 as? ViewObserver { observer.viewDidLayoutSubviews() }325 }326 }327 private func awake(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3) {328 if let awakable = viewController as? Awakable { awakable.awake() }329 if let awakable = e1 as? Awakable { awakable.awake() }330 if let awakable = e2 as? Awakable { awakable.awake() }331 if let awakable = e3 as? Awakable { awakable.awake() }332 }333}334public struct Scene4<ViewController: UIViewController, E1: AnyObject, E2: AnyObject, E3: AnyObject, E4: AnyObject> {335 let viewController: () -> ViewController336 let e1: () -> E1337 let e2: () -> E2338 let e3: () -> E3339 let e4: () -> E4340}341extension Scene4 {342 public func with<E5>(_ e5: @escaping () -> E5) -> Scene5<ViewController, E1, E2, E3, E4, E5> {343 return Scene5(viewController: viewController, e1: e1, e2: e2, e3: e3, e4: e4, e5: e5)344 }345}346extension Scene4 {347 public func instantiate() -> ViewController {348 let viewController = self.viewController()349 let e1 = self.e1()350 let e2 = self.e2()351 let e3 = self.e3()352 let e4 = self.e4()353 viewController.extras = (e1, e2, e3, e4)354 addViewObservers(viewController, e1, e2, e3, e4)355 awake(viewController, e1, e2, e3, e4)356 return viewController357 }358 public func instantiate(connect: (ViewController, E1, E2, E3, E4) -> Void) -> ViewController {359 let viewController = self.viewController()360 let e1 = self.e1()361 let e2 = self.e2()362 let e3 = self.e3()363 let e4 = self.e4()364 viewController.extras = (e1, e2, e3, e4)365 addViewObservers(viewController, e1, e2, e3, e4)366 connect(viewController, e1, e2, e3, e4)367 awake(viewController, e1, e2, e3, e4)368 return viewController369 }370 public func instantiate(view: @escaping (ViewController, E1, E2, E3, E4) -> UIView) -> ViewController {371 let viewController = self.viewController()372 let e1 = self.e1()373 let e2 = self.e2()374 let e3 = self.e3()375 let e4 = self.e4()376 viewController.extras = (e1, e2, e3, e4)377 addViewObservers(viewController, e1, e2, e3, e4)378 addViewBuilder(view, viewController, e1, e2, e3, e4)379 awake(viewController, e1, e2, e3, e4)380 return viewController381 }382 public func instantiate(connect: (ViewController, E1, E2, E3, E4) -> Void, view: @escaping (ViewController, E1, E2, E3, E4) -> UIView) -> ViewController {383 let viewController = self.viewController()384 let e1 = self.e1()385 let e2 = self.e2()386 let e3 = self.e3()387 let e4 = self.e4()388 viewController.extras = (e1, e2, e3, e4)389 addViewObservers(viewController, e1, e2, e3, e4)390 addViewBuilder(view, viewController, e1, e2, e3, e4)391 connect(viewController, e1, e2, e3, e4)392 awake(viewController, e1, e2, e3, e4)393 return viewController394 }395 private func addViewBuilder<View: UIView>(_ view: @escaping (ViewController, E1, E2, E3, E4) -> View, _ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4) {396 viewController.viewBuilder = { [weak viewController, weak e1, weak e2, weak e3, weak e4] in397 guard let viewController = viewController, let e1 = e1, let e2 = e2, let e3 = e3, let e4 = e4 else {398 return View()399 }400 return view(viewController, e1, e2, e3, e4)401 }402 }403 private func addViewObservers(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4) {404 viewController.didLoad = { [weak e1, weak e2, weak e3, weak e4] in405 if let observer = e1 as? ViewObserver { observer.viewDidLoad() }406 if let observer = e2 as? ViewObserver { observer.viewDidLoad() }407 if let observer = e3 as? ViewObserver { observer.viewDidLoad() }408 if let observer = e4 as? ViewObserver { observer.viewDidLoad() }409 }410 viewController.willAppear = { [weak e1, weak e2, weak e3, weak e4] animated in411 if let observer = e1 as? ViewObserver { observer.viewWillAppear(animated) }412 if let observer = e2 as? ViewObserver { observer.viewWillAppear(animated) }413 if let observer = e3 as? ViewObserver { observer.viewWillAppear(animated) }414 if let observer = e4 as? ViewObserver { observer.viewWillAppear(animated) }415 }416 viewController.didAppear = { [weak e1, weak e2, weak e3, weak e4] animated in417 if let observer = e1 as? ViewObserver { observer.viewDidAppear(animated) }418 if let observer = e2 as? ViewObserver { observer.viewDidAppear(animated) }419 if let observer = e3 as? ViewObserver { observer.viewDidAppear(animated) }420 if let observer = e4 as? ViewObserver { observer.viewDidAppear(animated) }421 }422 viewController.willDisappear = { [weak e1, weak e2, weak e3, weak e4] animated in423 if let observer = e1 as? ViewObserver { observer.viewWillDisappear(animated) }424 if let observer = e2 as? ViewObserver { observer.viewWillDisappear(animated) }425 if let observer = e3 as? ViewObserver { observer.viewWillDisappear(animated) }426 if let observer = e4 as? ViewObserver { observer.viewWillDisappear(animated) }427 }428 viewController.didDisappear = { [weak e1, weak e2, weak e3, weak e4] animated in429 if let observer = e1 as? ViewObserver { observer.viewDidDisappear(animated) }430 if let observer = e2 as? ViewObserver { observer.viewDidDisappear(animated) }431 if let observer = e3 as? ViewObserver { observer.viewDidDisappear(animated) }432 if let observer = e4 as? ViewObserver { observer.viewDidDisappear(animated) }433 }434 viewController.willLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4] in435 if let observer = e1 as? ViewObserver { observer.viewWillLayoutSubviews() }436 if let observer = e2 as? ViewObserver { observer.viewWillLayoutSubviews() }437 if let observer = e3 as? ViewObserver { observer.viewWillLayoutSubviews() }438 if let observer = e4 as? ViewObserver { observer.viewWillLayoutSubviews() }439 }440 viewController.didLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4] in441 if let observer = e1 as? ViewObserver { observer.viewDidLayoutSubviews() }442 if let observer = e2 as? ViewObserver { observer.viewDidLayoutSubviews() }443 if let observer = e3 as? ViewObserver { observer.viewDidLayoutSubviews() }444 if let observer = e4 as? ViewObserver { observer.viewDidLayoutSubviews() }445 }446 }447 private func awake(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4) {448 if let awakable = viewController as? Awakable { awakable.awake() }449 if let awakable = e1 as? Awakable { awakable.awake() }450 if let awakable = e2 as? Awakable { awakable.awake() }451 if let awakable = e3 as? Awakable { awakable.awake() }452 if let awakable = e4 as? Awakable { awakable.awake() }453 }454}455public struct Scene5<ViewController: UIViewController, E1: AnyObject, E2: AnyObject, E3: AnyObject, E4: AnyObject, E5: AnyObject> {456 let viewController: () -> ViewController457 let e1: () -> E1458 let e2: () -> E2459 let e3: () -> E3460 let e4: () -> E4461 let e5: () -> E5462}463extension Scene5 {464 public func with<E6>(_ e6: @escaping () -> E6) -> Scene6<ViewController, E1, E2, E3, E4, E5, E6> {465 return Scene6(viewController: viewController, e1: e1, e2: e2, e3: e3, e4: e4, e5: e5, e6: e6)466 }467}468extension Scene5 {469 public func instantiate() -> ViewController {470 let viewController = self.viewController()471 let e1 = self.e1()472 let e2 = self.e2()473 let e3 = self.e3()474 let e4 = self.e4()475 let e5 = self.e5()476 viewController.extras = (e1, e2, e3, e4, e5)477 addViewObservers(viewController, e1, e2, e3, e4, e5)478 awake(viewController, e1, e2, e3, e4, e5)479 return viewController480 }481 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5) -> Void) -> ViewController {482 let viewController = self.viewController()483 let e1 = self.e1()484 let e2 = self.e2()485 let e3 = self.e3()486 let e4 = self.e4()487 let e5 = self.e5()488 viewController.extras = (e1, e2, e3, e4, e5)489 addViewObservers(viewController, e1, e2, e3, e4, e5)490 connect(viewController, e1, e2, e3, e4, e5)491 awake(viewController, e1, e2, e3, e4, e5)492 return viewController493 }494 public func instantiate(view: @escaping (ViewController, E1, E2, E3, E4, E5) -> UIView) -> ViewController {495 let viewController = self.viewController()496 let e1 = self.e1()497 let e2 = self.e2()498 let e3 = self.e3()499 let e4 = self.e4()500 let e5 = self.e5()501 viewController.extras = (e1, e2, e3, e4, e5)502 addViewObservers(viewController, e1, e2, e3, e4, e5)503 addViewBuilder(view, viewController, e1, e2, e3, e4, e5)504 awake(viewController, e1, e2, e3, e4, e5)505 return viewController506 }507 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5) -> Void, view: @escaping (ViewController, E1, E2, E3, E4, E5) -> UIView) -> ViewController {508 let viewController = self.viewController()509 let e1 = self.e1()510 let e2 = self.e2()511 let e3 = self.e3()512 let e4 = self.e4()513 let e5 = self.e5()514 viewController.extras = (e1, e2, e3, e4, e5)515 addViewObservers(viewController, e1, e2, e3, e4, e5)516 addViewBuilder(view, viewController, e1, e2, e3, e4, e5)517 connect(viewController, e1, e2, e3, e4, e5)518 awake(viewController, e1, e2, e3, e4, e5)519 return viewController520 }521 private func addViewBuilder<View: UIView>(_ view: @escaping (ViewController, E1, E2, E3, E4, E5) -> View, _ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5) {522 viewController.viewBuilder = { [weak viewController, weak e1, weak e2, weak e3, weak e4, weak e5] in523 guard let viewController = viewController, let e1 = e1, let e2 = e2, let e3 = e3, let e4 = e4, let e5 = e5 else {524 return View()525 }526 return view(viewController, e1, e2, e3, e4, e5)527 }528 }529 private func addViewObservers(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5) {530 viewController.didLoad = { [weak e1, weak e2, weak e3, weak e4, weak e5] in531 if let observer = e1 as? ViewObserver { observer.viewDidLoad() }532 if let observer = e2 as? ViewObserver { observer.viewDidLoad() }533 if let observer = e3 as? ViewObserver { observer.viewDidLoad() }534 if let observer = e4 as? ViewObserver { observer.viewDidLoad() }535 if let observer = e5 as? ViewObserver { observer.viewDidLoad() }536 }537 viewController.willAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5] animated in538 if let observer = e1 as? ViewObserver { observer.viewWillAppear(animated) }539 if let observer = e2 as? ViewObserver { observer.viewWillAppear(animated) }540 if let observer = e3 as? ViewObserver { observer.viewWillAppear(animated) }541 if let observer = e4 as? ViewObserver { observer.viewWillAppear(animated) }542 if let observer = e5 as? ViewObserver { observer.viewWillAppear(animated) }543 }544 viewController.didAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5] animated in545 if let observer = e1 as? ViewObserver { observer.viewDidAppear(animated) }546 if let observer = e2 as? ViewObserver { observer.viewDidAppear(animated) }547 if let observer = e3 as? ViewObserver { observer.viewDidAppear(animated) }548 if let observer = e4 as? ViewObserver { observer.viewDidAppear(animated) }549 if let observer = e5 as? ViewObserver { observer.viewDidAppear(animated) }550 }551 viewController.willDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5] animated in552 if let observer = e1 as? ViewObserver { observer.viewWillDisappear(animated) }553 if let observer = e2 as? ViewObserver { observer.viewWillDisappear(animated) }554 if let observer = e3 as? ViewObserver { observer.viewWillDisappear(animated) }555 if let observer = e4 as? ViewObserver { observer.viewWillDisappear(animated) }556 if let observer = e5 as? ViewObserver { observer.viewWillDisappear(animated) }557 }558 viewController.didDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5] animated in559 if let observer = e1 as? ViewObserver { observer.viewDidDisappear(animated) }560 if let observer = e2 as? ViewObserver { observer.viewDidDisappear(animated) }561 if let observer = e3 as? ViewObserver { observer.viewDidDisappear(animated) }562 if let observer = e4 as? ViewObserver { observer.viewDidDisappear(animated) }563 if let observer = e5 as? ViewObserver { observer.viewDidDisappear(animated) }564 }565 viewController.willLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5] in566 if let observer = e1 as? ViewObserver { observer.viewWillLayoutSubviews() }567 if let observer = e2 as? ViewObserver { observer.viewWillLayoutSubviews() }568 if let observer = e3 as? ViewObserver { observer.viewWillLayoutSubviews() }569 if let observer = e4 as? ViewObserver { observer.viewWillLayoutSubviews() }570 if let observer = e5 as? ViewObserver { observer.viewWillLayoutSubviews() }571 }572 viewController.didLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5] in573 if let observer = e1 as? ViewObserver { observer.viewDidLayoutSubviews() }574 if let observer = e2 as? ViewObserver { observer.viewDidLayoutSubviews() }575 if let observer = e3 as? ViewObserver { observer.viewDidLayoutSubviews() }576 if let observer = e4 as? ViewObserver { observer.viewDidLayoutSubviews() }577 if let observer = e5 as? ViewObserver { observer.viewDidLayoutSubviews() }578 }579 }580 private func awake(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5) {581 if let awakable = viewController as? Awakable { awakable.awake() }582 if let awakable = e1 as? Awakable { awakable.awake() }583 if let awakable = e2 as? Awakable { awakable.awake() }584 if let awakable = e3 as? Awakable { awakable.awake() }585 if let awakable = e4 as? Awakable { awakable.awake() }586 if let awakable = e5 as? Awakable { awakable.awake() }587 }588}589public struct Scene6<ViewController: UIViewController, E1: AnyObject, E2: AnyObject, E3: AnyObject, E4: AnyObject, E5: AnyObject, E6: AnyObject> {590 let viewController: () -> ViewController591 let e1: () -> E1592 let e2: () -> E2593 let e3: () -> E3594 let e4: () -> E4595 let e5: () -> E5596 let e6: () -> E6597}598extension Scene6 {599 public func with<E7>(_ e7: @escaping () -> E7) -> Scene7<ViewController, E1, E2, E3, E4, E5, E6, E7> {600 return Scene7(viewController: viewController, e1: e1, e2: e2, e3: e3, e4: e4, e5: e5, e6: e6, e7: e7)601 }602}603extension Scene6 {604 public func instantiate() -> ViewController {605 let viewController = self.viewController()606 let e1 = self.e1()607 let e2 = self.e2()608 let e3 = self.e3()609 let e4 = self.e4()610 let e5 = self.e5()611 let e6 = self.e6()612 viewController.extras = (e1, e2, e3, e4, e5, e6)613 addViewObservers(viewController, e1, e2, e3, e4, e5, e6)614 awake(viewController, e1, e2, e3, e4, e5, e6)615 return viewController616 }617 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5, E6) -> Void) -> ViewController {618 let viewController = self.viewController()619 let e1 = self.e1()620 let e2 = self.e2()621 let e3 = self.e3()622 let e4 = self.e4()623 let e5 = self.e5()624 let e6 = self.e6()625 viewController.extras = (e1, e2, e3, e4, e5, e6)626 addViewObservers(viewController, e1, e2, e3, e4, e5, e6)627 connect(viewController, e1, e2, e3, e4, e5, e6)628 awake(viewController, e1, e2, e3, e4, e5, e6)629 return viewController630 }631 public func instantiate(view: @escaping (ViewController, E1, E2, E3, E4, E5, E6) -> UIView) -> ViewController {632 let viewController = self.viewController()633 let e1 = self.e1()634 let e2 = self.e2()635 let e3 = self.e3()636 let e4 = self.e4()637 let e5 = self.e5()638 let e6 = self.e6()639 viewController.extras = (e1, e2, e3, e4, e5, e6)640 addViewObservers(viewController, e1, e2, e3, e4, e5, e6)641 addViewBuilder(view, viewController, e1, e2, e3, e4, e5, e6)642 awake(viewController, e1, e2, e3, e4, e5, e6)643 return viewController644 }645 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5, E6) -> Void, view: @escaping (ViewController, E1, E2, E3, E4, E5, E6) -> UIView) -> ViewController {646 let viewController = self.viewController()647 let e1 = self.e1()648 let e2 = self.e2()649 let e3 = self.e3()650 let e4 = self.e4()651 let e5 = self.e5()652 let e6 = self.e6()653 viewController.extras = (e1, e2, e3, e4, e5, e6)654 addViewObservers(viewController, e1, e2, e3, e4, e5, e6)655 addViewBuilder(view, viewController, e1, e2, e3, e4, e5, e6)656 connect(viewController, e1, e2, e3, e4, e5, e6)657 awake(viewController, e1, e2, e3, e4, e5, e6)658 return viewController659 }660 private func addViewBuilder<View: UIView>(_ view: @escaping (ViewController, E1, E2, E3, E4, E5, E6) -> View, _ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6) {661 viewController.viewBuilder = { [weak viewController, weak e1, weak e2, weak e3, weak e4, weak e5, weak e6] in662 guard let viewController = viewController, let e1 = e1, let e2 = e2, let e3 = e3, let e4 = e4, let e5 = e5, let e6 = e6 else {663 return View()664 }665 return view(viewController, e1, e2, e3, e4, e5, e6)666 }667 }668 private func addViewObservers(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6) {669 viewController.didLoad = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6] in670 if let observer = e1 as? ViewObserver { observer.viewDidLoad() }671 if let observer = e2 as? ViewObserver { observer.viewDidLoad() }672 if let observer = e3 as? ViewObserver { observer.viewDidLoad() }673 if let observer = e4 as? ViewObserver { observer.viewDidLoad() }674 if let observer = e5 as? ViewObserver { observer.viewDidLoad() }675 if let observer = e6 as? ViewObserver { observer.viewDidLoad() }676 }677 viewController.willAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6] animated in678 if let observer = e1 as? ViewObserver { observer.viewWillAppear(animated) }679 if let observer = e2 as? ViewObserver { observer.viewWillAppear(animated) }680 if let observer = e3 as? ViewObserver { observer.viewWillAppear(animated) }681 if let observer = e4 as? ViewObserver { observer.viewWillAppear(animated) }682 if let observer = e5 as? ViewObserver { observer.viewWillAppear(animated) }683 if let observer = e6 as? ViewObserver { observer.viewWillAppear(animated) }684 }685 viewController.didAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6] animated in686 if let observer = e1 as? ViewObserver { observer.viewDidAppear(animated) }687 if let observer = e2 as? ViewObserver { observer.viewDidAppear(animated) }688 if let observer = e3 as? ViewObserver { observer.viewDidAppear(animated) }689 if let observer = e4 as? ViewObserver { observer.viewDidAppear(animated) }690 if let observer = e5 as? ViewObserver { observer.viewDidAppear(animated) }691 if let observer = e6 as? ViewObserver { observer.viewDidAppear(animated) }692 }693 viewController.willDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6] animated in694 if let observer = e1 as? ViewObserver { observer.viewWillDisappear(animated) }695 if let observer = e2 as? ViewObserver { observer.viewWillDisappear(animated) }696 if let observer = e3 as? ViewObserver { observer.viewWillDisappear(animated) }697 if let observer = e4 as? ViewObserver { observer.viewWillDisappear(animated) }698 if let observer = e5 as? ViewObserver { observer.viewWillDisappear(animated) }699 if let observer = e6 as? ViewObserver { observer.viewWillDisappear(animated) }700 }701 viewController.didDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6] animated in702 if let observer = e1 as? ViewObserver { observer.viewDidDisappear(animated) }703 if let observer = e2 as? ViewObserver { observer.viewDidDisappear(animated) }704 if let observer = e3 as? ViewObserver { observer.viewDidDisappear(animated) }705 if let observer = e4 as? ViewObserver { observer.viewDidDisappear(animated) }706 if let observer = e5 as? ViewObserver { observer.viewDidDisappear(animated) }707 if let observer = e6 as? ViewObserver { observer.viewDidDisappear(animated) }708 }709 viewController.willLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6] in710 if let observer = e1 as? ViewObserver { observer.viewWillLayoutSubviews() }711 if let observer = e2 as? ViewObserver { observer.viewWillLayoutSubviews() }712 if let observer = e3 as? ViewObserver { observer.viewWillLayoutSubviews() }713 if let observer = e4 as? ViewObserver { observer.viewWillLayoutSubviews() }714 if let observer = e5 as? ViewObserver { observer.viewWillLayoutSubviews() }715 if let observer = e6 as? ViewObserver { observer.viewWillLayoutSubviews() }716 }717 viewController.didLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6] in718 if let observer = e1 as? ViewObserver { observer.viewDidLayoutSubviews() }719 if let observer = e2 as? ViewObserver { observer.viewDidLayoutSubviews() }720 if let observer = e3 as? ViewObserver { observer.viewDidLayoutSubviews() }721 if let observer = e4 as? ViewObserver { observer.viewDidLayoutSubviews() }722 if let observer = e5 as? ViewObserver { observer.viewDidLayoutSubviews() }723 if let observer = e6 as? ViewObserver { observer.viewDidLayoutSubviews() }724 }725 }726 private func awake(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6) {727 if let awakable = viewController as? Awakable { awakable.awake() }728 if let awakable = e1 as? Awakable { awakable.awake() }729 if let awakable = e2 as? Awakable { awakable.awake() }730 if let awakable = e3 as? Awakable { awakable.awake() }731 if let awakable = e4 as? Awakable { awakable.awake() }732 if let awakable = e5 as? Awakable { awakable.awake() }733 if let awakable = e6 as? Awakable { awakable.awake() }734 }735}736public struct Scene7<ViewController: UIViewController, E1: AnyObject, E2: AnyObject, E3: AnyObject, E4: AnyObject, E5: AnyObject, E6: AnyObject, E7: AnyObject> {737 let viewController: () -> ViewController738 let e1: () -> E1739 let e2: () -> E2740 let e3: () -> E3741 let e4: () -> E4742 let e5: () -> E5743 let e6: () -> E6744 let e7: () -> E7745}746extension Scene7 {747 public func with<E8>(_ e8: @escaping () -> E8) -> Scene8<ViewController, E1, E2, E3, E4, E5, E6, E7, E8> {748 return Scene8(viewController: viewController, e1: e1, e2: e2, e3: e3, e4: e4, e5: e5, e6: e6, e7: e7, e8: e8)749 }750}751extension Scene7 {752 public func instantiate() -> ViewController {753 let viewController = self.viewController()754 let e1 = self.e1()755 let e2 = self.e2()756 let e3 = self.e3()757 let e4 = self.e4()758 let e5 = self.e5()759 let e6 = self.e6()760 let e7 = self.e7()761 viewController.extras = (e1, e2, e3, e4, e5, e6, e7)762 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7)763 awake(viewController, e1, e2, e3, e4, e5, e6, e7)764 return viewController765 }766 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5, E6, E7) -> Void) -> ViewController {767 let viewController = self.viewController()768 let e1 = self.e1()769 let e2 = self.e2()770 let e3 = self.e3()771 let e4 = self.e4()772 let e5 = self.e5()773 let e6 = self.e6()774 let e7 = self.e7()775 viewController.extras = (e1, e2, e3, e4, e5, e6, e7)776 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7)777 connect(viewController, e1, e2, e3, e4, e5, e6, e7)778 awake(viewController, e1, e2, e3, e4, e5, e6, e7)779 return viewController780 }781 public func instantiate(view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7) -> UIView) -> ViewController {782 let viewController = self.viewController()783 let e1 = self.e1()784 let e2 = self.e2()785 let e3 = self.e3()786 let e4 = self.e4()787 let e5 = self.e5()788 let e6 = self.e6()789 let e7 = self.e7()790 viewController.extras = (e1, e2, e3, e4, e5, e6, e7)791 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7)792 addViewBuilder(view, viewController, e1, e2, e3, e4, e5, e6, e7)793 awake(viewController, e1, e2, e3, e4, e5, e6, e7)794 return viewController795 }796 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5, E6, E7) -> Void, view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7) -> UIView) -> ViewController {797 let viewController = self.viewController()798 let e1 = self.e1()799 let e2 = self.e2()800 let e3 = self.e3()801 let e4 = self.e4()802 let e5 = self.e5()803 let e6 = self.e6()804 let e7 = self.e7()805 viewController.extras = (e1, e2, e3, e4, e5, e6, e7)806 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7)807 addViewBuilder(view, viewController, e1, e2, e3, e4, e5, e6, e7)808 connect(viewController, e1, e2, e3, e4, e5, e6, e7)809 awake(viewController, e1, e2, e3, e4, e5, e6, e7)810 return viewController811 }812 private func addViewBuilder<View: UIView>(_ view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7) -> View, _ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7) {813 viewController.viewBuilder = { [weak viewController, weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7] in814 guard let viewController = viewController, let e1 = e1, let e2 = e2, let e3 = e3, let e4 = e4, let e5 = e5, let e6 = e6, let e7 = e7 else {815 return View()816 }817 return view(viewController, e1, e2, e3, e4, e5, e6, e7)818 }819 }820 private func addViewObservers(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7) {821 viewController.didLoad = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7] in822 if let observer = e1 as? ViewObserver { observer.viewDidLoad() }823 if let observer = e2 as? ViewObserver { observer.viewDidLoad() }824 if let observer = e3 as? ViewObserver { observer.viewDidLoad() }825 if let observer = e4 as? ViewObserver { observer.viewDidLoad() }826 if let observer = e5 as? ViewObserver { observer.viewDidLoad() }827 if let observer = e6 as? ViewObserver { observer.viewDidLoad() }828 if let observer = e7 as? ViewObserver { observer.viewDidLoad() }829 }830 viewController.willAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7] animated in831 if let observer = e1 as? ViewObserver { observer.viewWillAppear(animated) }832 if let observer = e2 as? ViewObserver { observer.viewWillAppear(animated) }833 if let observer = e3 as? ViewObserver { observer.viewWillAppear(animated) }834 if let observer = e4 as? ViewObserver { observer.viewWillAppear(animated) }835 if let observer = e5 as? ViewObserver { observer.viewWillAppear(animated) }836 if let observer = e6 as? ViewObserver { observer.viewWillAppear(animated) }837 if let observer = e7 as? ViewObserver { observer.viewWillAppear(animated) }838 }839 viewController.didAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7] animated in840 if let observer = e1 as? ViewObserver { observer.viewDidAppear(animated) }841 if let observer = e2 as? ViewObserver { observer.viewDidAppear(animated) }842 if let observer = e3 as? ViewObserver { observer.viewDidAppear(animated) }843 if let observer = e4 as? ViewObserver { observer.viewDidAppear(animated) }844 if let observer = e5 as? ViewObserver { observer.viewDidAppear(animated) }845 if let observer = e6 as? ViewObserver { observer.viewDidAppear(animated) }846 if let observer = e7 as? ViewObserver { observer.viewDidAppear(animated) }847 }848 viewController.willDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7] animated in849 if let observer = e1 as? ViewObserver { observer.viewWillDisappear(animated) }850 if let observer = e2 as? ViewObserver { observer.viewWillDisappear(animated) }851 if let observer = e3 as? ViewObserver { observer.viewWillDisappear(animated) }852 if let observer = e4 as? ViewObserver { observer.viewWillDisappear(animated) }853 if let observer = e5 as? ViewObserver { observer.viewWillDisappear(animated) }854 if let observer = e6 as? ViewObserver { observer.viewWillDisappear(animated) }855 if let observer = e7 as? ViewObserver { observer.viewWillDisappear(animated) }856 }857 viewController.didDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7] animated in858 if let observer = e1 as? ViewObserver { observer.viewDidDisappear(animated) }859 if let observer = e2 as? ViewObserver { observer.viewDidDisappear(animated) }860 if let observer = e3 as? ViewObserver { observer.viewDidDisappear(animated) }861 if let observer = e4 as? ViewObserver { observer.viewDidDisappear(animated) }862 if let observer = e5 as? ViewObserver { observer.viewDidDisappear(animated) }863 if let observer = e6 as? ViewObserver { observer.viewDidDisappear(animated) }864 if let observer = e7 as? ViewObserver { observer.viewDidDisappear(animated) }865 }866 viewController.willLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7] in867 if let observer = e1 as? ViewObserver { observer.viewWillLayoutSubviews() }868 if let observer = e2 as? ViewObserver { observer.viewWillLayoutSubviews() }869 if let observer = e3 as? ViewObserver { observer.viewWillLayoutSubviews() }870 if let observer = e4 as? ViewObserver { observer.viewWillLayoutSubviews() }871 if let observer = e5 as? ViewObserver { observer.viewWillLayoutSubviews() }872 if let observer = e6 as? ViewObserver { observer.viewWillLayoutSubviews() }873 if let observer = e7 as? ViewObserver { observer.viewWillLayoutSubviews() }874 }875 viewController.didLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7] in876 if let observer = e1 as? ViewObserver { observer.viewDidLayoutSubviews() }877 if let observer = e2 as? ViewObserver { observer.viewDidLayoutSubviews() }878 if let observer = e3 as? ViewObserver { observer.viewDidLayoutSubviews() }879 if let observer = e4 as? ViewObserver { observer.viewDidLayoutSubviews() }880 if let observer = e5 as? ViewObserver { observer.viewDidLayoutSubviews() }881 if let observer = e6 as? ViewObserver { observer.viewDidLayoutSubviews() }882 if let observer = e7 as? ViewObserver { observer.viewDidLayoutSubviews() }883 }884 }885 private func awake(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7) {886 if let awakable = viewController as? Awakable { awakable.awake() }887 if let awakable = e1 as? Awakable { awakable.awake() }888 if let awakable = e2 as? Awakable { awakable.awake() }889 if let awakable = e3 as? Awakable { awakable.awake() }890 if let awakable = e4 as? Awakable { awakable.awake() }891 if let awakable = e5 as? Awakable { awakable.awake() }892 if let awakable = e6 as? Awakable { awakable.awake() }893 if let awakable = e7 as? Awakable { awakable.awake() }894 }895}896public struct Scene8<ViewController: UIViewController, E1: AnyObject, E2: AnyObject, E3: AnyObject, E4: AnyObject, E5: AnyObject, E6: AnyObject, E7: AnyObject, E8: AnyObject> {897 let viewController: () -> ViewController898 let e1: () -> E1899 let e2: () -> E2900 let e3: () -> E3901 let e4: () -> E4902 let e5: () -> E5903 let e6: () -> E6904 let e7: () -> E7905 let e8: () -> E8906}907extension Scene8 {908 public func with<E9>(_ e9: @escaping () -> E9) -> Scene9<ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9> {909 return Scene9(viewController: viewController, e1: e1, e2: e2, e3: e3, e4: e4, e5: e5, e6: e6, e7: e7, e8: e8, e9: e9)910 }911}912extension Scene8 {913 public func instantiate() -> ViewController {914 let viewController = self.viewController()915 let e1 = self.e1()916 let e2 = self.e2()917 let e3 = self.e3()918 let e4 = self.e4()919 let e5 = self.e5()920 let e6 = self.e6()921 let e7 = self.e7()922 let e8 = self.e8()923 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8)924 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8)925 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8)926 return viewController927 }928 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5, E6, E7, E8) -> Void) -> ViewController {929 let viewController = self.viewController()930 let e1 = self.e1()931 let e2 = self.e2()932 let e3 = self.e3()933 let e4 = self.e4()934 let e5 = self.e5()935 let e6 = self.e6()936 let e7 = self.e7()937 let e8 = self.e8()938 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8)939 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8)940 connect(viewController, e1, e2, e3, e4, e5, e6, e7, e8)941 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8)942 return viewController943 }944 public func instantiate(view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7, E8) -> UIView) -> ViewController {945 let viewController = self.viewController()946 let e1 = self.e1()947 let e2 = self.e2()948 let e3 = self.e3()949 let e4 = self.e4()950 let e5 = self.e5()951 let e6 = self.e6()952 let e7 = self.e7()953 let e8 = self.e8()954 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8)955 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8)956 addViewBuilder(view, viewController, e1, e2, e3, e4, e5, e6, e7, e8)957 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8)958 return viewController959 }960 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5, E6, E7, E8) -> Void, view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7, E8) -> UIView) -> ViewController {961 let viewController = self.viewController()962 let e1 = self.e1()963 let e2 = self.e2()964 let e3 = self.e3()965 let e4 = self.e4()966 let e5 = self.e5()967 let e6 = self.e6()968 let e7 = self.e7()969 let e8 = self.e8()970 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8)971 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8)972 addViewBuilder(view, viewController, e1, e2, e3, e4, e5, e6, e7, e8)973 connect(viewController, e1, e2, e3, e4, e5, e6, e7, e8)974 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8)975 return viewController976 }977 private func addViewBuilder<View: UIView>(_ view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7, E8) -> View, _ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7, _ e8: E8) {978 viewController.viewBuilder = { [weak viewController, weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8] in979 guard let viewController = viewController, let e1 = e1, let e2 = e2, let e3 = e3, let e4 = e4, let e5 = e5, let e6 = e6, let e7 = e7, let e8 = e8 else {980 return View()981 }982 return view(viewController, e1, e2, e3, e4, e5, e6, e7, e8)983 }984 }985 private func addViewObservers(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7, _ e8: E8) {986 viewController.didLoad = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8] in987 if let observer = e1 as? ViewObserver { observer.viewDidLoad() }988 if let observer = e2 as? ViewObserver { observer.viewDidLoad() }989 if let observer = e3 as? ViewObserver { observer.viewDidLoad() }990 if let observer = e4 as? ViewObserver { observer.viewDidLoad() }991 if let observer = e5 as? ViewObserver { observer.viewDidLoad() }992 if let observer = e6 as? ViewObserver { observer.viewDidLoad() }993 if let observer = e7 as? ViewObserver { observer.viewDidLoad() }994 if let observer = e8 as? ViewObserver { observer.viewDidLoad() }995 }996 viewController.willAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8] animated in997 if let observer = e1 as? ViewObserver { observer.viewWillAppear(animated) }998 if let observer = e2 as? ViewObserver { observer.viewWillAppear(animated) }999 if let observer = e3 as? ViewObserver { observer.viewWillAppear(animated) }1000 if let observer = e4 as? ViewObserver { observer.viewWillAppear(animated) }1001 if let observer = e5 as? ViewObserver { observer.viewWillAppear(animated) }1002 if let observer = e6 as? ViewObserver { observer.viewWillAppear(animated) }1003 if let observer = e7 as? ViewObserver { observer.viewWillAppear(animated) }1004 if let observer = e8 as? ViewObserver { observer.viewWillAppear(animated) }1005 }1006 viewController.didAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8] animated in1007 if let observer = e1 as? ViewObserver { observer.viewDidAppear(animated) }1008 if let observer = e2 as? ViewObserver { observer.viewDidAppear(animated) }1009 if let observer = e3 as? ViewObserver { observer.viewDidAppear(animated) }1010 if let observer = e4 as? ViewObserver { observer.viewDidAppear(animated) }1011 if let observer = e5 as? ViewObserver { observer.viewDidAppear(animated) }1012 if let observer = e6 as? ViewObserver { observer.viewDidAppear(animated) }1013 if let observer = e7 as? ViewObserver { observer.viewDidAppear(animated) }1014 if let observer = e8 as? ViewObserver { observer.viewDidAppear(animated) }1015 }1016 viewController.willDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8] animated in1017 if let observer = e1 as? ViewObserver { observer.viewWillDisappear(animated) }1018 if let observer = e2 as? ViewObserver { observer.viewWillDisappear(animated) }1019 if let observer = e3 as? ViewObserver { observer.viewWillDisappear(animated) }1020 if let observer = e4 as? ViewObserver { observer.viewWillDisappear(animated) }1021 if let observer = e5 as? ViewObserver { observer.viewWillDisappear(animated) }1022 if let observer = e6 as? ViewObserver { observer.viewWillDisappear(animated) }1023 if let observer = e7 as? ViewObserver { observer.viewWillDisappear(animated) }1024 if let observer = e8 as? ViewObserver { observer.viewWillDisappear(animated) }1025 }1026 viewController.didDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8] animated in1027 if let observer = e1 as? ViewObserver { observer.viewDidDisappear(animated) }1028 if let observer = e2 as? ViewObserver { observer.viewDidDisappear(animated) }1029 if let observer = e3 as? ViewObserver { observer.viewDidDisappear(animated) }1030 if let observer = e4 as? ViewObserver { observer.viewDidDisappear(animated) }1031 if let observer = e5 as? ViewObserver { observer.viewDidDisappear(animated) }1032 if let observer = e6 as? ViewObserver { observer.viewDidDisappear(animated) }1033 if let observer = e7 as? ViewObserver { observer.viewDidDisappear(animated) }1034 if let observer = e8 as? ViewObserver { observer.viewDidDisappear(animated) }1035 }1036 viewController.willLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8] in1037 if let observer = e1 as? ViewObserver { observer.viewWillLayoutSubviews() }1038 if let observer = e2 as? ViewObserver { observer.viewWillLayoutSubviews() }1039 if let observer = e3 as? ViewObserver { observer.viewWillLayoutSubviews() }1040 if let observer = e4 as? ViewObserver { observer.viewWillLayoutSubviews() }1041 if let observer = e5 as? ViewObserver { observer.viewWillLayoutSubviews() }1042 if let observer = e6 as? ViewObserver { observer.viewWillLayoutSubviews() }1043 if let observer = e7 as? ViewObserver { observer.viewWillLayoutSubviews() }1044 if let observer = e8 as? ViewObserver { observer.viewWillLayoutSubviews() }1045 }1046 viewController.didLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8] in1047 if let observer = e1 as? ViewObserver { observer.viewDidLayoutSubviews() }1048 if let observer = e2 as? ViewObserver { observer.viewDidLayoutSubviews() }1049 if let observer = e3 as? ViewObserver { observer.viewDidLayoutSubviews() }1050 if let observer = e4 as? ViewObserver { observer.viewDidLayoutSubviews() }1051 if let observer = e5 as? ViewObserver { observer.viewDidLayoutSubviews() }1052 if let observer = e6 as? ViewObserver { observer.viewDidLayoutSubviews() }1053 if let observer = e7 as? ViewObserver { observer.viewDidLayoutSubviews() }1054 if let observer = e8 as? ViewObserver { observer.viewDidLayoutSubviews() }1055 }1056 }1057 private func awake(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7, _ e8: E8) {1058 if let awakable = viewController as? Awakable { awakable.awake() }1059 if let awakable = e1 as? Awakable { awakable.awake() }1060 if let awakable = e2 as? Awakable { awakable.awake() }1061 if let awakable = e3 as? Awakable { awakable.awake() }1062 if let awakable = e4 as? Awakable { awakable.awake() }1063 if let awakable = e5 as? Awakable { awakable.awake() }1064 if let awakable = e6 as? Awakable { awakable.awake() }1065 if let awakable = e7 as? Awakable { awakable.awake() }1066 if let awakable = e8 as? Awakable { awakable.awake() }1067 }1068}1069public struct Scene9<ViewController: UIViewController, E1: AnyObject, E2: AnyObject, E3: AnyObject, E4: AnyObject, E5: AnyObject, E6: AnyObject, E7: AnyObject, E8: AnyObject, E9: AnyObject> {1070 let viewController: () -> ViewController1071 let e1: () -> E11072 let e2: () -> E21073 let e3: () -> E31074 let e4: () -> E41075 let e5: () -> E51076 let e6: () -> E61077 let e7: () -> E71078 let e8: () -> E81079 let e9: () -> E91080}1081extension Scene9 {1082 public func with<E10>(_ e10: @escaping () -> E10) -> Scene10<ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10> {1083 return Scene10(viewController: viewController, e1: e1, e2: e2, e3: e3, e4: e4, e5: e5, e6: e6, e7: e7, e8: e8, e9: e9, e10: e10)1084 }1085}1086extension Scene9 {1087 public func instantiate() -> ViewController {1088 let viewController = self.viewController()1089 let e1 = self.e1()1090 let e2 = self.e2()1091 let e3 = self.e3()1092 let e4 = self.e4()1093 let e5 = self.e5()1094 let e6 = self.e6()1095 let e7 = self.e7()1096 let e8 = self.e8()1097 let e9 = self.e9()1098 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8, e9)1099 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1100 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1101 return viewController1102 }1103 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9) -> Void) -> ViewController {1104 let viewController = self.viewController()1105 let e1 = self.e1()1106 let e2 = self.e2()1107 let e3 = self.e3()1108 let e4 = self.e4()1109 let e5 = self.e5()1110 let e6 = self.e6()1111 let e7 = self.e7()1112 let e8 = self.e8()1113 let e9 = self.e9()1114 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8, e9)1115 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1116 connect(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1117 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1118 return viewController1119 }1120 public func instantiate(view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9) -> UIView) -> ViewController {1121 let viewController = self.viewController()1122 let e1 = self.e1()1123 let e2 = self.e2()1124 let e3 = self.e3()1125 let e4 = self.e4()1126 let e5 = self.e5()1127 let e6 = self.e6()1128 let e7 = self.e7()1129 let e8 = self.e8()1130 let e9 = self.e9()1131 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8, e9)1132 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1133 addViewBuilder(view, viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1134 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1135 return viewController1136 }1137 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9) -> Void, view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9) -> UIView) -> ViewController {1138 let viewController = self.viewController()1139 let e1 = self.e1()1140 let e2 = self.e2()1141 let e3 = self.e3()1142 let e4 = self.e4()1143 let e5 = self.e5()1144 let e6 = self.e6()1145 let e7 = self.e7()1146 let e8 = self.e8()1147 let e9 = self.e9()1148 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8, e9)1149 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1150 addViewBuilder(view, viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1151 connect(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1152 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1153 return viewController1154 }1155 private func addViewBuilder<View: UIView>(_ view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9) -> View, _ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7, _ e8: E8, _ e9: E9) {1156 viewController.viewBuilder = { [weak viewController, weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9] in1157 guard let viewController = viewController, let e1 = e1, let e2 = e2, let e3 = e3, let e4 = e4, let e5 = e5, let e6 = e6, let e7 = e7, let e8 = e8, let e9 = e9 else {1158 return View()1159 }1160 return view(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9)1161 }1162 }1163 private func addViewObservers(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7, _ e8: E8, _ e9: E9) {1164 viewController.didLoad = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9] in1165 if let observer = e1 as? ViewObserver { observer.viewDidLoad() }1166 if let observer = e2 as? ViewObserver { observer.viewDidLoad() }1167 if let observer = e3 as? ViewObserver { observer.viewDidLoad() }1168 if let observer = e4 as? ViewObserver { observer.viewDidLoad() }1169 if let observer = e5 as? ViewObserver { observer.viewDidLoad() }1170 if let observer = e6 as? ViewObserver { observer.viewDidLoad() }1171 if let observer = e7 as? ViewObserver { observer.viewDidLoad() }1172 if let observer = e8 as? ViewObserver { observer.viewDidLoad() }1173 if let observer = e9 as? ViewObserver { observer.viewDidLoad() }1174 }1175 viewController.willAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9] animated in1176 if let observer = e1 as? ViewObserver { observer.viewWillAppear(animated) }1177 if let observer = e2 as? ViewObserver { observer.viewWillAppear(animated) }1178 if let observer = e3 as? ViewObserver { observer.viewWillAppear(animated) }1179 if let observer = e4 as? ViewObserver { observer.viewWillAppear(animated) }1180 if let observer = e5 as? ViewObserver { observer.viewWillAppear(animated) }1181 if let observer = e6 as? ViewObserver { observer.viewWillAppear(animated) }1182 if let observer = e7 as? ViewObserver { observer.viewWillAppear(animated) }1183 if let observer = e8 as? ViewObserver { observer.viewWillAppear(animated) }1184 if let observer = e9 as? ViewObserver { observer.viewWillAppear(animated) }1185 }1186 viewController.didAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9] animated in1187 if let observer = e1 as? ViewObserver { observer.viewDidAppear(animated) }1188 if let observer = e2 as? ViewObserver { observer.viewDidAppear(animated) }1189 if let observer = e3 as? ViewObserver { observer.viewDidAppear(animated) }1190 if let observer = e4 as? ViewObserver { observer.viewDidAppear(animated) }1191 if let observer = e5 as? ViewObserver { observer.viewDidAppear(animated) }1192 if let observer = e6 as? ViewObserver { observer.viewDidAppear(animated) }1193 if let observer = e7 as? ViewObserver { observer.viewDidAppear(animated) }1194 if let observer = e8 as? ViewObserver { observer.viewDidAppear(animated) }1195 if let observer = e9 as? ViewObserver { observer.viewDidAppear(animated) }1196 }1197 viewController.willDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9] animated in1198 if let observer = e1 as? ViewObserver { observer.viewWillDisappear(animated) }1199 if let observer = e2 as? ViewObserver { observer.viewWillDisappear(animated) }1200 if let observer = e3 as? ViewObserver { observer.viewWillDisappear(animated) }1201 if let observer = e4 as? ViewObserver { observer.viewWillDisappear(animated) }1202 if let observer = e5 as? ViewObserver { observer.viewWillDisappear(animated) }1203 if let observer = e6 as? ViewObserver { observer.viewWillDisappear(animated) }1204 if let observer = e7 as? ViewObserver { observer.viewWillDisappear(animated) }1205 if let observer = e8 as? ViewObserver { observer.viewWillDisappear(animated) }1206 if let observer = e9 as? ViewObserver { observer.viewWillDisappear(animated) }1207 }1208 viewController.didDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9] animated in1209 if let observer = e1 as? ViewObserver { observer.viewDidDisappear(animated) }1210 if let observer = e2 as? ViewObserver { observer.viewDidDisappear(animated) }1211 if let observer = e3 as? ViewObserver { observer.viewDidDisappear(animated) }1212 if let observer = e4 as? ViewObserver { observer.viewDidDisappear(animated) }1213 if let observer = e5 as? ViewObserver { observer.viewDidDisappear(animated) }1214 if let observer = e6 as? ViewObserver { observer.viewDidDisappear(animated) }1215 if let observer = e7 as? ViewObserver { observer.viewDidDisappear(animated) }1216 if let observer = e8 as? ViewObserver { observer.viewDidDisappear(animated) }1217 if let observer = e9 as? ViewObserver { observer.viewDidDisappear(animated) }1218 }1219 viewController.willLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9] in1220 if let observer = e1 as? ViewObserver { observer.viewWillLayoutSubviews() }1221 if let observer = e2 as? ViewObserver { observer.viewWillLayoutSubviews() }1222 if let observer = e3 as? ViewObserver { observer.viewWillLayoutSubviews() }1223 if let observer = e4 as? ViewObserver { observer.viewWillLayoutSubviews() }1224 if let observer = e5 as? ViewObserver { observer.viewWillLayoutSubviews() }1225 if let observer = e6 as? ViewObserver { observer.viewWillLayoutSubviews() }1226 if let observer = e7 as? ViewObserver { observer.viewWillLayoutSubviews() }1227 if let observer = e8 as? ViewObserver { observer.viewWillLayoutSubviews() }1228 if let observer = e9 as? ViewObserver { observer.viewWillLayoutSubviews() }1229 }1230 viewController.didLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9] in1231 if let observer = e1 as? ViewObserver { observer.viewDidLayoutSubviews() }1232 if let observer = e2 as? ViewObserver { observer.viewDidLayoutSubviews() }1233 if let observer = e3 as? ViewObserver { observer.viewDidLayoutSubviews() }1234 if let observer = e4 as? ViewObserver { observer.viewDidLayoutSubviews() }1235 if let observer = e5 as? ViewObserver { observer.viewDidLayoutSubviews() }1236 if let observer = e6 as? ViewObserver { observer.viewDidLayoutSubviews() }1237 if let observer = e7 as? ViewObserver { observer.viewDidLayoutSubviews() }1238 if let observer = e8 as? ViewObserver { observer.viewDidLayoutSubviews() }1239 if let observer = e9 as? ViewObserver { observer.viewDidLayoutSubviews() }1240 }1241 }1242 private func awake(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7, _ e8: E8, _ e9: E9) {1243 if let awakable = viewController as? Awakable { awakable.awake() }1244 if let awakable = e1 as? Awakable { awakable.awake() }1245 if let awakable = e2 as? Awakable { awakable.awake() }1246 if let awakable = e3 as? Awakable { awakable.awake() }1247 if let awakable = e4 as? Awakable { awakable.awake() }1248 if let awakable = e5 as? Awakable { awakable.awake() }1249 if let awakable = e6 as? Awakable { awakable.awake() }1250 if let awakable = e7 as? Awakable { awakable.awake() }1251 if let awakable = e8 as? Awakable { awakable.awake() }1252 if let awakable = e9 as? Awakable { awakable.awake() }1253 }1254}1255public struct Scene10<ViewController: UIViewController, E1: AnyObject, E2: AnyObject, E3: AnyObject, E4: AnyObject, E5: AnyObject, E6: AnyObject, E7: AnyObject, E8: AnyObject, E9: AnyObject, E10: AnyObject> {1256 let viewController: () -> ViewController1257 let e1: () -> E11258 let e2: () -> E21259 let e3: () -> E31260 let e4: () -> E41261 let e5: () -> E51262 let e6: () -> E61263 let e7: () -> E71264 let e8: () -> E81265 let e9: () -> E91266 let e10: () -> E101267}1268extension Scene10 {1269 public func instantiate() -> ViewController {1270 let viewController = self.viewController()1271 let e1 = self.e1()1272 let e2 = self.e2()1273 let e3 = self.e3()1274 let e4 = self.e4()1275 let e5 = self.e5()1276 let e6 = self.e6()1277 let e7 = self.e7()1278 let e8 = self.e8()1279 let e9 = self.e9()1280 let e10 = self.e10()1281 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1282 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1283 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1284 return viewController1285 }1286 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10) -> Void) -> ViewController {1287 let viewController = self.viewController()1288 let e1 = self.e1()1289 let e2 = self.e2()1290 let e3 = self.e3()1291 let e4 = self.e4()1292 let e5 = self.e5()1293 let e6 = self.e6()1294 let e7 = self.e7()1295 let e8 = self.e8()1296 let e9 = self.e9()1297 let e10 = self.e10()1298 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1299 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1300 connect(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1301 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1302 return viewController1303 }1304 public func instantiate(view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10) -> UIView) -> ViewController {1305 let viewController = self.viewController()1306 let e1 = self.e1()1307 let e2 = self.e2()1308 let e3 = self.e3()1309 let e4 = self.e4()1310 let e5 = self.e5()1311 let e6 = self.e6()1312 let e7 = self.e7()1313 let e8 = self.e8()1314 let e9 = self.e9()1315 let e10 = self.e10()1316 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1317 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1318 addViewBuilder(view, viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1319 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1320 return viewController1321 }1322 public func instantiate(connect: (ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10) -> Void, view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10) -> UIView) -> ViewController {1323 let viewController = self.viewController()1324 let e1 = self.e1()1325 let e2 = self.e2()1326 let e3 = self.e3()1327 let e4 = self.e4()1328 let e5 = self.e5()1329 let e6 = self.e6()1330 let e7 = self.e7()1331 let e8 = self.e8()1332 let e9 = self.e9()1333 let e10 = self.e10()1334 viewController.extras = (e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1335 addViewObservers(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1336 addViewBuilder(view, viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1337 connect(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1338 awake(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1339 return viewController1340 }1341 private func addViewBuilder<View: UIView>(_ view: @escaping (ViewController, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10) -> View, _ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7, _ e8: E8, _ e9: E9, _ e10: E10) {1342 viewController.viewBuilder = { [weak viewController, weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9, weak e10] in1343 guard let viewController = viewController, let e1 = e1, let e2 = e2, let e3 = e3, let e4 = e4, let e5 = e5, let e6 = e6, let e7 = e7, let e8 = e8, let e9 = e9, let e10 = e10 else {1344 return View()1345 }1346 return view(viewController, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)1347 }1348 }1349 private func addViewObservers(_ viewController: ViewController, _ e1: E1, _ e2: E2, _ e3: E3, _ e4: E4, _ e5: E5, _ e6: E6, _ e7: E7, _ e8: E8, _ e9: E9, _ e10: E10) {1350 viewController.didLoad = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9, weak e10] in1351 if let observer = e1 as? ViewObserver { observer.viewDidLoad() }1352 if let observer = e2 as? ViewObserver { observer.viewDidLoad() }1353 if let observer = e3 as? ViewObserver { observer.viewDidLoad() }1354 if let observer = e4 as? ViewObserver { observer.viewDidLoad() }1355 if let observer = e5 as? ViewObserver { observer.viewDidLoad() }1356 if let observer = e6 as? ViewObserver { observer.viewDidLoad() }1357 if let observer = e7 as? ViewObserver { observer.viewDidLoad() }1358 if let observer = e8 as? ViewObserver { observer.viewDidLoad() }1359 if let observer = e9 as? ViewObserver { observer.viewDidLoad() }1360 if let observer = e10 as? ViewObserver { observer.viewDidLoad() }1361 }1362 viewController.willAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9, weak e10] animated in1363 if let observer = e1 as? ViewObserver { observer.viewWillAppear(animated) }1364 if let observer = e2 as? ViewObserver { observer.viewWillAppear(animated) }1365 if let observer = e3 as? ViewObserver { observer.viewWillAppear(animated) }1366 if let observer = e4 as? ViewObserver { observer.viewWillAppear(animated) }1367 if let observer = e5 as? ViewObserver { observer.viewWillAppear(animated) }1368 if let observer = e6 as? ViewObserver { observer.viewWillAppear(animated) }1369 if let observer = e7 as? ViewObserver { observer.viewWillAppear(animated) }1370 if let observer = e8 as? ViewObserver { observer.viewWillAppear(animated) }1371 if let observer = e9 as? ViewObserver { observer.viewWillAppear(animated) }1372 if let observer = e10 as? ViewObserver { observer.viewWillAppear(animated) }1373 }1374 viewController.didAppear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9, weak e10] animated in1375 if let observer = e1 as? ViewObserver { observer.viewDidAppear(animated) }1376 if let observer = e2 as? ViewObserver { observer.viewDidAppear(animated) }1377 if let observer = e3 as? ViewObserver { observer.viewDidAppear(animated) }1378 if let observer = e4 as? ViewObserver { observer.viewDidAppear(animated) }1379 if let observer = e5 as? ViewObserver { observer.viewDidAppear(animated) }1380 if let observer = e6 as? ViewObserver { observer.viewDidAppear(animated) }1381 if let observer = e7 as? ViewObserver { observer.viewDidAppear(animated) }1382 if let observer = e8 as? ViewObserver { observer.viewDidAppear(animated) }1383 if let observer = e9 as? ViewObserver { observer.viewDidAppear(animated) }1384 if let observer = e10 as? ViewObserver { observer.viewDidAppear(animated) }1385 }1386 viewController.willDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9, weak e10] animated in1387 if let observer = e1 as? ViewObserver { observer.viewWillDisappear(animated) }1388 if let observer = e2 as? ViewObserver { observer.viewWillDisappear(animated) }1389 if let observer = e3 as? ViewObserver { observer.viewWillDisappear(animated) }1390 if let observer = e4 as? ViewObserver { observer.viewWillDisappear(animated) }1391 if let observer = e5 as? ViewObserver { observer.viewWillDisappear(animated) }1392 if let observer = e6 as? ViewObserver { observer.viewWillDisappear(animated) }1393 if let observer = e7 as? ViewObserver { observer.viewWillDisappear(animated) }1394 if let observer = e8 as? ViewObserver { observer.viewWillDisappear(animated) }1395 if let observer = e9 as? ViewObserver { observer.viewWillDisappear(animated) }1396 if let observer = e10 as? ViewObserver { observer.viewWillDisappear(animated) }1397 }1398 viewController.didDisappear = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9, weak e10] animated in1399 if let observer = e1 as? ViewObserver { observer.viewDidDisappear(animated) }1400 if let observer = e2 as? ViewObserver { observer.viewDidDisappear(animated) }1401 if let observer = e3 as? ViewObserver { observer.viewDidDisappear(animated) }1402 if let observer = e4 as? ViewObserver { observer.viewDidDisappear(animated) }1403 if let observer = e5 as? ViewObserver { observer.viewDidDisappear(animated) }1404 if let observer = e6 as? ViewObserver { observer.viewDidDisappear(animated) }1405 if let observer = e7 as? ViewObserver { observer.viewDidDisappear(animated) }1406 if let observer = e8 as? ViewObserver { observer.viewDidDisappear(animated) }1407 if let observer = e9 as? ViewObserver { observer.viewDidDisappear(animated) }1408 if let observer = e10 as? ViewObserver { observer.viewDidDisappear(animated) }1409 }1410 viewController.willLayoutSubviews = { [weak e1, weak e2, weak e3, weak e4, weak e5, weak e6, weak e7, weak e8, weak e9, weak e10] in...
UIViewController+AddBehaviors.swift
Source:UIViewController+AddBehaviors.swift
2protocol ViewControllerLifecycleBehavior {3 func viewDidLoad(viewController: UIViewController)4 func viewWillAppear(viewController: UIViewController)5 func viewDidAppear(viewController: UIViewController)6 func viewWillDisappear(viewController: UIViewController)7 func viewDidDisappear(viewController: UIViewController)8 func viewWillLayoutSubviews(viewController: UIViewController)9 func viewDidLayoutSubviews(viewController: UIViewController)10}11// Default implementations12extension ViewControllerLifecycleBehavior {13 func viewDidLoad(viewController: UIViewController) {}14 func viewWillAppear(viewController: UIViewController) {}15 func viewDidAppear(viewController: UIViewController) {}16 func viewWillDisappear(viewController: UIViewController) {}17 func viewDidDisappear(viewController: UIViewController) {}18 func viewWillLayoutSubviews(viewController: UIViewController) {}19 func viewDidLayoutSubviews(viewController: UIViewController) {}20}21extension UIViewController {22 /*23 Add behaviors to be hooked into this view controllerâs lifecycle.24 This method requires the view controllerâs view to be loaded, so itâs best to call25 in `viewDidLoad` to avoid it being loaded prematurely.26 - parameter behaviors: Behaviors to be added.27 */28 func addBehaviors(_ behaviors: [ViewControllerLifecycleBehavior]) {29 let behaviorViewController = LifecycleBehaviorViewController(behaviors: behaviors)30 addChild(behaviorViewController)31 view.addSubview(behaviorViewController.view)32 behaviorViewController.didMove(toParent: self)33 }34 private final class LifecycleBehaviorViewController: UIViewController, UIGestureRecognizerDelegate {35 private let behaviors: [ViewControllerLifecycleBehavior]36 // MARK: - Lifecycle37 init(behaviors: [ViewControllerLifecycleBehavior]) {38 self.behaviors = behaviors39 super.init(nibName: nil, bundle: nil)40 }41 required init?(coder aDecoder: NSCoder) {42 fatalError("init(coder:) has not been implemented")43 }44 override func viewDidLoad() {45 super.viewDidLoad()46 view.isHidden = true47 applyBehaviors { behavior, viewController in48 behavior.viewDidLoad(viewController: viewController)49 }50 }51 override func viewWillAppear(_ animated: Bool) {52 super.viewWillAppear(animated)53 applyBehaviors { behavior, viewController in54 behavior.viewWillAppear(viewController: viewController)55 }56 }57 override func viewDidAppear(_ animated: Bool) {58 super.viewDidAppear(animated)59 applyBehaviors { behavior, viewController in60 behavior.viewDidAppear(viewController: viewController)61 }62 }63 override func viewWillDisappear(_ animated: Bool) {64 super.viewWillDisappear(animated)65 applyBehaviors { behavior, viewController in66 behavior.viewWillDisappear(viewController: viewController)67 }68 }69 override func viewDidDisappear(_ animated: Bool) {70 super.viewDidDisappear(animated)71 applyBehaviors { behavior, viewController in72 behavior.viewDidDisappear(viewController: viewController)73 }74 }75 override func viewWillLayoutSubviews() {76 super.viewWillLayoutSubviews()77 applyBehaviors { behavior, viewController in78 behavior.viewWillLayoutSubviews(viewController: viewController)79 }80 }...
PresenterInterface.swift
Source:PresenterInterface.swift
...8protocol PresenterInterface: class {9 func viewDidLoad()10 func viewWillAppear(animated: Bool)11 func viewDidAppear(animated: Bool)12 func viewWillDisappear(animated: Bool)13 func viewDidDisappear(animated: Bool)14}15// MARK: - Presenter Interface Helpers16/// PresenterInterface extra capabilities (for checking wether it's properly called on ViewController)17extension PresenterInterface {18 /// Throw an error if presenter called viewDidLoad but hasn't been called inside ViewController19 func viewDidLoad() {20 fatalError("viewDidLoad hasn't been called inside ViewController")21 }22 /// Throw an error if presenter called viewWillAppear but hasn't been called inside ViewController23 func viewWillAppear(animated: Bool) {24 fatalError("viewWillAppear hasn't been called inside ViewController")25 }26 /// Throw an error if presenter called viewDidAppear but hasn't been called inside ViewController27 func viewDidAppear(animated: Bool) {28 fatalError("viewDidAppear hasn't been called inside ViewController")29 }30 /// Throw an error if presenter called viewWillDisappear but hasn't been called inside ViewController31 func viewWillDisappear(animated: Bool) {32 fatalError("viewWillDisappear hasn't been called inside ViewController")33 }34 /// Throw an error if presenter called viewDidDisappear but hasn't been called inside ViewController35 func viewDidDisappear(animated: Bool) {36 fatalError("viewDidDisappear hasn't been called inside ViewController")37 }38}...
viewWillDisappear
Using AI Code Generation
1override func viewWillDisappear(_ animated: Bool) {2 super.viewWillDisappear(animated)3 print("viewWillDisappear")4}5override func viewWillAppear(_ animated: Bool) {6 super.viewWillAppear(animated)7 print("viewWillAppear")8}9override func viewDidAppear(_ animated: Bool) {10 super.viewDidAppear(animated)11 print("viewDidAppear")12}13override func viewDidLoad() {14 super.viewDidLoad()15 print("viewDidLoad")16}17override func viewDidLayoutSubviews() {18 super.viewDidLayoutSubviews()19 print("viewDidLayoutSubviews")20}21override func viewWillLayoutSubviews() {22 super.viewWillLayoutSubviews()23 print("viewWillLayoutSubviews")24}25override func viewDidDisappear(_ animated: Bool) {26 super.viewDidDisappear(animated)27 print("viewDidDisappear")28}29override func didReceiveMemoryWarning() {30 super.didReceiveMemoryWarning()31 print("didReceiveMemoryWarning")32}33override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {34 super.viewWillTransition(to: size, with: coordinator)35 print("viewWillTransition")36}37override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {38 super.viewWillTransition(to: size, with: coordinator)39 print("viewWillTransition")40}41override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {42 super.viewWillTransition(to: size, with: coordinator)43 print("viewWillTransition")44}
viewWillDisappear
Using AI Code Generation
1override func viewWillDisappear(_ animated: Bool) {2 super.viewWillDisappear(animated)3 print("viewWillDisappear")4}5override func viewDidDisappear(_ animated: Bool) {6 super.viewDidDisappear(animated)7 print("viewDidDisappear")8}9override func viewWillAppear(_ animated: Bool) {10 super.viewWillAppear(animated)11 print("viewWillAppear")12}13override func viewDidAppear(_ animated: Bool) {14 super.viewDidAppear(animated)15 print("viewDidAppear")16}17override func viewDidLoad() {18 super.viewDidLoad()19 print("viewDidLoad")20}21override func viewWillLayoutSubviews() {22 super.viewWillLayoutSubviews()23 print("viewWillLayoutSubviews")24}25override func viewDidLayoutSubviews() {26 super.viewDidLayoutSubviews()27 print("viewDidLayoutSubviews")28}29override func didReceiveMemoryWarning() {30 super.didReceiveMemoryWarning()31 print("didReceiveMemoryWarning")32}33override func prepare(for segue: UIStoryboardSegue, sender: Any?) {34 super.prepare(for: segue, sender: sender)35 print("prepare")36}37override func didReceiveMemoryWarning() {38 super.didReceiveMemoryWarning()39 print("didReceiveMemoryWarning")40}41override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {42 super.viewWillTransition(to: size, with: coordinator)43 print("viewWillTransition")44}45override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {46 super.viewWillTransition(to: size, with: coordinator)47 print("viewWillTransition")48}
viewWillDisappear
Using AI Code Generation
1override func viewWillDisappear(_ animated: Bool) {2 super.viewWillDisappear(animated)3 print("view will disappear")4}5override func viewDidDisappear(_ animated: Bool) {6 super.viewDidDisappear(animated)7 print("view did disappear")8}9override func viewWillAppear(_ animated: Bool) {10 super.viewWillAppear(animated)11 print("view will appear")12}13override func viewDidAppear(_ animated: Bool) {14 super.viewDidAppear(animated)15 print("view did appear")16}17override func viewDidLoad() {18 super.viewDidLoad()19 print("view did load")20}21override func didReceiveMemoryWarning() {22 super.didReceiveMemoryWarning()23 print("did receive memory warning")24}25override func viewWillLayoutSubviews() {26 super.viewWillLayoutSubviews()27 print("view will layout subviews")28}29override func viewDidLayoutSubviews() {30 super.viewDidLayoutSubviews()31 print("view did layout subviews")32}33override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {34 super.viewWillTransition(to: size, with: coordinator)35 print("view will transition")36}37override func viewWillLayoutSubviews() {38 super.viewWillLayoutSubviews()39 print("view will layout subviews")40}41override func viewDidLayoutSubviews() {42 super.viewDidLayoutSubviews()43 print("view did layout subviews")44}45override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
viewWillDisappear
Using AI Code Generation
1override func viewWillDisappear(animated: Bool) {2 super.viewWillDisappear(animated)3 print("viewWillDisappear")4}5override func viewWillDisappear(animated: Bool) {6 super.viewWillDisappear(animated)7 print("viewWillDisappear")8}9override func viewWillDisappear(animated: Bool) {10 super.viewWillDisappear(animated)11 print("viewWillDisappear")12}13override func viewWillDisappear(animated: Bool) {14 super.viewWillDisappear(animated)15 print("viewWillDisappear")16}17override func viewWillDisappear(animated: Bool) {18 super.viewWillDisappear(animated)19 print("viewWillDisappear")20}21override func viewWillDisappear(animated: Bool) {22 super.viewWillDisappear(animated)23 print("viewWillDisappear")24}25override func viewWillDisappear(animated: Bool) {26 super.viewWillDisappear(animated)27 print("viewWillDisappear")28}29override func viewWillDisappear(animated: Bool) {30 super.viewWillDisappear(animated)31 print("viewWillDisappear")32}33override func viewWillDisappear(animated: Bool) {34 super.viewWillDisappear(animated)35 print("viewWillDisappear")36}37override func viewWillDisappear(animated: Bool) {38 super.viewWillDisappear(animated)39 print("viewWillDisappear")40}41override func viewWillDisappear(animated: Bool) {42 super.viewWillDisappear(animated)43 print("viewWillDisappear")44}45override func viewWillDisappear(animated: Bool) {46 super.viewWillDisappear(animated)47 print("viewWillDisappear")48}49override func viewWillDisappear(animated: Bool) {50 super.viewWillDisappear(animated)51 print("
viewWillDisappear
Using AI Code Generation
1override func viewWillDisappear(_ animated: Bool) {2 super.viewWillDisappear(animated)3 print("View Will Disappear")4}5override func viewDidDisappear(_ animated: Bool) {6 super.viewDidDisappear(animated)7 print("View Did Disappear")8}9override func viewWillAppear(_ animated: Bool) {10 super.viewWillAppear(animated)11 print("View Will Appear")12}13override func viewDidAppear(_ animated: Bool) {14 super.viewDidAppear(animated)15 print("View Did Appear")16}17override func viewDidLoad() {18 super.viewDidLoad()19 print("View Did Load")20}21override func didReceiveMemoryWarning() {22 super.didReceiveMemoryWarning()23 print("Memory Warning")24}25override func viewWillLayoutSubviews() {26 super.viewWillLayoutSubviews()27 print("View Will Layout Subviews")28}29override func viewDidLayoutSubviews() {30 super.viewDidLayoutSubviews()31 print("View Did Layout Subviews")32}33override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {34 super.viewWillTransition(to: size, with: coordinator)35 print("View Will Transition")36}37override func viewSafeAreaInsetsDidChange() {38 super.viewSafeAreaInsetsDidChange()39 print("View Safe Area Insets Did Change")40}41override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {42 super.traitCollectionDidChange(previousTraitCollection)43 print("Trait Collection Did Change")44}45override func preferredContentSizeDidChange(forChild
viewWillDisappear
Using AI Code Generation
1override func viewWillDisappear(_ animated: Bool) {2 print("viewWillDisappear method is called")3}4override func viewDidDisappear(_ animated: Bool) {5 print("viewDidDisappear method is called")6}7override func viewWillAppear(_ animated: Bool) {8 print("viewWillAppear method is called")9}10override func viewDidAppear(_ animated: Bool) {11 print("viewDidAppear method is called")12}13override func viewDidLoad() {14 super.viewDidLoad()15 print("viewDidLoad method is called")16}17override func viewWillLayoutSubviews() {18 print("viewWillLayoutSubviews method is called")19}20override func viewDidLayoutSubviews() {21 print("viewDidLayoutSubviews method is called")22}23override func didReceiveMemoryWarning() {24 super.didReceiveMemoryWarning()25 print("didReceiveMemoryWarning method is called")26}27override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {28 print("viewWillTransition method is called")29}30override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {31 print("traitCollectionDidChange method is called")32}33override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) {34 print("willTransition method is called")35}36override func willMove(toParentViewController parent: UIViewController?) {37 print("willMove method is called")38}39override func didMove(toParentViewController parent: UIViewController?) {
viewWillDisappear
Using AI Code Generation
1override func viewWillDisappear(animated: Bool) {2 super.viewWillDisappear(animated)3 self.view.endEditing(true)4}5override func viewWillDisappear(animated: Bool) {6 super.viewWillDisappear(animated)7 self.view.endEditing(true)8}9override func viewWillDisappear(animated: Bool) {10 super.viewWillDisappear(animated)11 self.view.endEditing(true)12}13override func viewWillDisappear(animated: Bool) {14 super.viewWillDisappear(animated)15 self.view.endEditing(true)16}17override func viewWillDisappear(animated: Bool) {18 super.viewWillDisappear(animated)19 self.view.endEditing(true)20}21override func viewWillDisappear(animated: Bool) {22 super.viewWillDisappear(animated)23 self.view.endEditing(true)24}25override func viewWillDisappear(animated: Bool) {26 super.viewWillDisappear(animated)27 self.view.endEditing(true)28}29override func viewWillDisappear(animated: Bool) {30 super.viewWillDisappear(animated)31 self.view.endEditing(true)32}33override func viewWillDisappear(animated: Bool) {34 super.viewWillDisappear(animated)35 self.view.endEditing(true)36}37override func viewWillDisappear(animated: Bool) {38 super.viewWillDisappear(animated)39 self.view.endEditing(true)40}41override func viewWillDisappear(animated: Bool) {42 super.viewWillDisappear(animated)43 self.view.endEditing(true)44}45override func viewWillDisappear(animated: Bool) {46 super.viewWillDisappear(animated)47 self.view.endEditing(true)48}49override func viewWillDisappear(animated:
viewWillDisappear
Using AI Code Generation
1override func viewWillDisappear(animated: Bool) {2 super.viewWillDisappear(animated)3 }4override func viewWillDisappear(animated: Bool) {5 super.viewWillDisappear(animated)6 }7override func viewWillDisappear(animated: Bool) {8 super.viewWillDisappear(animated)9 }10override func viewWillDisappear(animated: Bool) {11 super.viewWillDisappear(animated)12 }13override func viewWillDisappear(animated: Bool) {14 super.viewWillDisappear(animated)15 }16override func viewWillDisappear(animated: Bool) {17 super.viewWillDisappear(animated)18 }19override func viewWillDisappear(animated: Bool) {20 super.viewWillDisappear(animated)21 }22override func viewWillDisappear(animated: Bool) {23 super.viewWillDisappear(animated)24 }25override func viewWillDisappear(animated: Bool) {26 super.viewWillDisappear(animated)27 }28override func viewWillDisappear(animated: Bool) {29 super.viewWillDisappear(animated)30 }31override func viewWillDisappear(animated: Bool) {32 super.viewWillDisappear(animated)33 }
viewWillDisappear
Using AI Code Generation
1override func viewWillDisappear(animated: Bool) {2 super.viewWillDisappear(animated)3 print("viewWillDisappear")4}5override func viewWillDisappear(animated: Bool) {6 super.viewWillDisappear(animated)7 print("viewWillDisappear")8}9override func viewWillDisappear(animated: Bool) {10 super.viewWillDisappear(animated)11 print("viewWillDisappear")12}13override func viewWillDisappear(animated: Bool) {14 super.viewWillDisappear(animated)15 print("viewWillDisappear")16}17override func viewWillDisappear(animated: Bool) {18 super.viewWillDisappear(animated)19 print("viewWillDisappear")20}21override func viewWillDisappear(animated: Bool) {22 super.viewWillDisappear(animated)23 print("viewWillDisappear")24}25override func viewWillDisappear(animated: Bool) {26 super.viewWillDisappear(animated)27 print("viewWillDisappear")28}29override func viewWillDisappear(animated: Bool) {30 super.viewWillDisappear(animated)31 print("viewWillDisappear")32}33override func viewWillDisappear(animated: Bool) {34 super.viewWillDisappear(animated)35 print("viewWillDisappear")36}37override func viewWillDisappear(animated: Bool) {38 super.viewWillDisappear(animated)39 print("viewWillDisappear")40}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!