From a437e8b7987641126eb675a8e8d181c63070cad5 Mon Sep 17 00:00:00 2001 From: Pedro Paulo de Amorim Date: Sat, 2 May 2020 08:41:40 +0100 Subject: [PATCH] Fix transition, view controller leak and add fade transition --- CircularRevealKit.podspec | 2 +- .../Classes/CicularTransactionDirector.swift | 14 +- CircularRevealKit/Classes/LayerAnimator.swift | 4 + .../UICircularViewControllerExtension.swift | 359 +++++++++++------- CircularRevealKit/Classes/UIViewRadial.swift | 2 + .../project.pbxproj | 6 + .../CircularRevealKit-Example.xcscheme | 30 +- .../CircularRevealKit/CircularViewCell.swift | 8 - .../FirstViewController.swift | 15 +- .../SecondViewController.swift | 8 +- .../CircularRevealKit-Info.plist | 40 +- README.md | 10 +- 12 files changed, 298 insertions(+), 200 deletions(-) diff --git a/CircularRevealKit.podspec b/CircularRevealKit.podspec index 80c838d..c6b3571 100644 --- a/CircularRevealKit.podspec +++ b/CircularRevealKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'CircularRevealKit' - s.version = '0.9.1' + s.version = '0.9.2' s.summary = 'Circular reveal animations made easy' s.homepage = 'https://github.com/T-Pro/CircularRevealKit' s.description = 'This library was created to allow developers to implement the material design reveal effect.' diff --git a/CircularRevealKit/Classes/CicularTransactionDirector.swift b/CircularRevealKit/Classes/CicularTransactionDirector.swift index 7218cf8..1b90704 100644 --- a/CircularRevealKit/Classes/CicularTransactionDirector.swift +++ b/CircularRevealKit/Classes/CicularTransactionDirector.swift @@ -26,7 +26,7 @@ import UIKit public typealias AnimationBlock = (( _ transactionContext: UIViewControllerContextTransitioning, _ animationTime: TimeInterval, - _ transitionCompletion: @escaping () -> Void) -> Void) + _ transitionCompletion: @escaping (_ didComplete: Bool) -> Void) -> Void) public class CicularTransactionDirector: NSObject { @@ -34,6 +34,10 @@ public class CicularTransactionDirector: NSObject { public var transitionContext: UIViewControllerContextTransitioning? public var animationBlock: AnimationBlock? + deinit { + animationBlock = nil + } + } extension CicularTransactionDirector: UIViewControllerAnimatedTransitioning { @@ -45,8 +49,8 @@ extension CicularTransactionDirector: UIViewControllerAnimatedTransitioning { public func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { self.transitionContext = transitionContext - self.animationBlock?(transitionContext, duration) { - transitionContext.completeTransition(true) + self.animationBlock?(transitionContext, duration) { (didComplete: Bool) in + transitionContext.completeTransition(didComplete) } } @@ -56,7 +60,9 @@ extension CicularTransactionDirector: UIViewControllerInteractiveTransitioning { public func startInteractiveTransition(_ transitionContext: UIViewControllerContextTransitioning) { self.transitionContext = transitionContext - self.animationBlock?(transitionContext, duration) { } + self.animationBlock?(transitionContext, duration) { (didComplete: Bool) in + transitionContext.completeTransition(didComplete) + } } } diff --git a/CircularRevealKit/Classes/LayerAnimator.swift b/CircularRevealKit/Classes/LayerAnimator.swift index bd964c9..8146d5c 100644 --- a/CircularRevealKit/Classes/LayerAnimator.swift +++ b/CircularRevealKit/Classes/LayerAnimator.swift @@ -59,7 +59,11 @@ class LayerAnimator: NSObject, CAAnimationDelegate { func animationDidStop(_ anim: CAAnimation, finished flag: Bool) { animLayer?.removeAllAnimations() + animLayer = nil + caAnimation = nil completionBlock?() + completionBlock = nil + } } diff --git a/CircularRevealKit/Classes/UICircularViewControllerExtension.swift b/CircularRevealKit/Classes/UICircularViewControllerExtension.swift index 60105d3..cac575c 100644 --- a/CircularRevealKit/Classes/UICircularViewControllerExtension.swift +++ b/CircularRevealKit/Classes/UICircularViewControllerExtension.swift @@ -27,70 +27,86 @@ public extension UIViewController { func radialPresent( viewController: UIViewController, - _ duration: TimeInterval = DEFAULT_CIRCULAR_ANIMATION_DURATION, - _ startFrame: CGRect = CGRect.zero, - _ fadeColor: UIColor? = nil, + duration: TimeInterval = DEFAULT_CIRCULAR_ANIMATION_DURATION, + startFrame: CGRect = CGRect.zero, + fadeColor: UIColor? = nil, _ completion: (() -> Void)? = nil) { self.push(viewController, duration, startFrame, fadeColor, revealType: .reveal, completion) } func radialDismiss( - _ duration: TimeInterval = DEFAULT_CIRCULAR_ANIMATION_DURATION, - _ startFrame: CGRect = CGRect.zero, - _ fadeColor: UIColor?, + duration: TimeInterval = DEFAULT_CIRCULAR_ANIMATION_DURATION, + startFrame: CGRect = CGRect.zero, + fadeColor: UIColor? = nil, _ completion: (() -> Void)? = nil) { self.push(nil, duration, startFrame, fadeColor, revealType: .unreveal, completion) } - - private func push( - _ viewController: UIViewController?, - _ duration: TimeInterval = DEFAULT_CIRCULAR_ANIMATION_DURATION, - _ startFrame: CGRect = CGRect.zero, - _ fadeColor: UIColor?, - revealType: RevealType = .reveal, - _ transitionCompletion: (() -> Void)? = nil) { - - let rect: CGRect - + + private func validateUINavigationController() -> Bool { var isNavigationController: Bool = false - + if self.presentingViewController != nil { isNavigationController = self.presentingViewController is UINavigationController } - + if !isNavigationController && self.parent != nil { isNavigationController = self.parent is UINavigationController } - + if !isNavigationController { isNavigationController = self is UINavigationController } - + + return isNavigationController + } + + private func buildStartRectIfNeeded( + _ startFrame: CGRect = CGRect.zero, + _ isNavigationController: Bool) -> CGRect { if startFrame == CGRect.zero { - + let viewControllerSize: CGSize? - + if isNavigationController { viewControllerSize = (self.parent as? UINavigationController)?.view.frame.size } else { viewControllerSize = self.view.frame.size } - rect = CGRect( + return CGRect( origin: CGPoint( x: (viewControllerSize?.width ?? 0)/2, y: (viewControllerSize?.height ?? 0)/2), size: CGSize( width: 0, height: 0)) - } else { - rect = startFrame } + return startFrame + } + + private func buildFadeView(_ fadeColor: UIColor?, _ frame: CGRect) -> UIView? { + if let fadeColor: UIColor = fadeColor { + let fadeView = UIView(frame: frame) + fadeView.backgroundColor = fadeColor + return fadeView + } + return nil + } + + private func push( + _ viewController: UIViewController?, + _ duration: TimeInterval = DEFAULT_CIRCULAR_ANIMATION_DURATION, + _ startFrame: CGRect = CGRect.zero, + _ fadeColor: UIColor?, + revealType: RevealType = .reveal, + _ transitionCompletion: (() -> Void)? = nil) { + let isNavigationController: Bool = validateUINavigationController() + let rect: CGRect = buildStartRectIfNeeded(startFrame, isNavigationController) + if isNavigationController { let animatorDirector: CicularTransactionDirector = CicularTransactionDirector() animatorDirector.duration = duration - (self.parent as? UINavigationController)?.delegate = animatorDirector animatorDirector.animationBlock = { (transactionContext, animationTime, completion) in let toViewController: UIViewController? = transactionContext.viewController( @@ -104,67 +120,108 @@ public extension UIViewController { let toViewSnapshot: UIView = toView.snapshotView(afterScreenUpdates: true), let fromViewSnapshot: UIView = fromView.snapshotView(afterScreenUpdates: true) { - let fadeView: UIView = UIView(frame: fromView.frame) - fadeView.backgroundColor = fadeColor + let fadeView: UIView? = self.buildFadeView(fadeColor, fromView.frame) switch revealType { case RevealType.reveal: - transactionContext.containerView.insertSubview( - toView, - aboveSubview: fromView) - fromViewSnapshot.isOpaque = true + fromViewSnapshot.isHidden = true transactionContext.containerView.addSubview(fromViewSnapshot) - fadeView.alpha = 0.01 - transactionContext.containerView.addSubview(fadeView) + DispatchQueue.main.asyncAfter(deadline: .now()) { - transactionContext.containerView.addSubview(toViewSnapshot) + if let fadeView: UIView = fadeView { + fadeView.alpha = 0.01 + transactionContext.containerView.addSubview(fadeView) + } - UIView.animate(withDuration: animationTime) { - fadeView.alpha = 1.0 - } + toViewSnapshot.isHidden = true + transactionContext.containerView.addSubview(toViewSnapshot) + + transactionContext.containerView.insertSubview( + toView, + aboveSubview: fromView) + + toViewSnapshot.layoutIfNeeded() + fromViewSnapshot.layoutIfNeeded() + + UIView.animate(withDuration: animationTime) { + fadeView?.alpha = 1.0 + } + + toViewSnapshot.drawAnimatedCircularMask( + startFrame: rect, + duration: animationTime, + revealType: revealType) { () -> Void in + + DispatchQueue.main.asyncAfter(deadline: .now()) { + completion(true) + transitionCompletion?() + fromViewSnapshot.removeFromSuperview() + fadeView?.removeFromSuperview() + toViewSnapshot.removeFromSuperview() + } + + } + + fromViewSnapshot.isHidden = false + toViewSnapshot.isHidden = false + fadeView?.isHidden = false - toViewSnapshot.drawAnimatedCircularMask( - startFrame: rect, - duration: animationTime, - revealType: revealType) { () -> Void in - fromViewSnapshot.removeFromSuperview() - fadeView.removeFromSuperview() - toViewSnapshot.removeFromSuperview() - completion() - transitionCompletion?() } - - case RevealType.unreveal: - transactionContext.containerView.insertSubview( - toView, - belowSubview: fromView) + case RevealType.unreveal: toViewSnapshot.isOpaque = true + toViewSnapshot.isHidden = true transactionContext.containerView.addSubview(toViewSnapshot) - fadeView.alpha = 0.0 - transactionContext.containerView.addSubview(fadeView) + DispatchQueue.main.asyncAfter(deadline: .now()) { - transactionContext.containerView.addSubview(fromViewSnapshot) + if let fadeView: UIView = fadeView { + fadeView.alpha = 1.0 + fadeView.isHidden = true + transactionContext.containerView.addSubview(fadeView) + } - UIView.animate(withDuration: animationTime) { - fadeView.alpha = 0.01 - } + fromViewSnapshot.isHidden = true + transactionContext.containerView.addSubview(fromViewSnapshot) + + // toView.isHidden = true + transactionContext.containerView.insertSubview( + toView, + belowSubview: fromView) + + toViewSnapshot.layoutIfNeeded() + fromViewSnapshot.layoutIfNeeded() + + UIView.animate(withDuration: animationTime) { + fadeView?.alpha = 0.01 + } + + fromViewSnapshot.drawAnimatedCircularMask( + startFrame: rect, + duration: animationTime, + revealType: revealType) { () -> Void in + + DispatchQueue.main.asyncAfter(deadline: .now()) { + completion(true) + transitionCompletion?() + fromViewSnapshot.removeFromSuperview() + fadeView?.removeFromSuperview() + toViewSnapshot.removeFromSuperview() + fromViewController?.view.removeFromSuperview() + toView.isHidden = false + } + + } + + fromViewSnapshot.isHidden = false + toViewSnapshot.isHidden = false + fadeView?.isHidden = false - fromViewSnapshot.drawAnimatedCircularMask( - startFrame: rect, - duration: animationTime, - revealType: revealType) { () -> Void in - fromViewSnapshot.removeFromSuperview() - fadeView.removeFromSuperview() - toViewSnapshot.removeFromSuperview() - completion() - transitionCompletion?() } } @@ -172,102 +229,118 @@ public extension UIViewController { } } + + guard let navigationController: UINavigationController = self.parent as? UINavigationController else { + return + } + + navigationController.delegate = animatorDirector switch revealType { case RevealType.reveal: if let viewController: UIViewController = viewController { - (self.parent as? UINavigationController)?.pushViewController(viewController, animated: true) + navigationController.pushViewController(viewController, animated: true) return } - fatalError("ViewController is nil") case RevealType.unreveal: - (self.parent as? UINavigationController)?.popViewController(animated: true) + navigationController.popViewController(animated: true) } + + return + } - } else { - - switch revealType { - - case RevealType.reveal: - - guard let fromViewControllerSnapshot: UIView = self.view.snapshotView(afterScreenUpdates: true), - let toViewControllerSnapshot: UIView = viewController?.view.snapshotView(afterScreenUpdates: true) else { - fatalError("Error to take snapshots") - } + switch revealType { - let fadeView: UIView = UIView(frame: fromViewControllerSnapshot.frame) - fadeView.backgroundColor = fadeColor - fadeView.alpha = 0.0 + case RevealType.reveal: - fromViewControllerSnapshot.isOpaque = true - toViewControllerSnapshot.isOpaque = true + guard let fromViewControllerSnapshot: UIView = self.view.snapshotView(afterScreenUpdates: true), + let toViewControllerSnapshot: UIView = viewController?.view.snapshotView(afterScreenUpdates: true) else { + fatalError("Error to take snapshots") + } - fromViewControllerSnapshot.layer.shouldRasterize = true - toViewControllerSnapshot.layer.rasterizationScale = UIScreen.main.scale + let fadeView: UIView? = buildFadeView(fadeColor, fromViewControllerSnapshot.frame) + fadeView?.alpha = 0.0 - fromViewControllerSnapshot.layer.shouldRasterize = true - toViewControllerSnapshot.layer.rasterizationScale = UIScreen.main.scale - - self.view?.addSubview(fromViewControllerSnapshot) + fromViewControllerSnapshot.isOpaque = true + toViewControllerSnapshot.isOpaque = true + + fromViewControllerSnapshot.layer.shouldRasterize = true + toViewControllerSnapshot.layer.rasterizationScale = UIScreen.main.scale + + fromViewControllerSnapshot.layer.shouldRasterize = true + toViewControllerSnapshot.layer.rasterizationScale = UIScreen.main.scale + + self.view?.addSubview(fromViewControllerSnapshot) + if let fadeView: UIView = fadeView { self.view?.addSubview(fadeView) - self.view?.addSubview(toViewControllerSnapshot) + } + self.view?.addSubview(toViewControllerSnapshot) - UIView.animate(withDuration: duration) { - fadeView.alpha = 1.0 - } - - toViewControllerSnapshot.drawAnimatedCircularMask( - startFrame: rect, - duration: duration, - revealType: revealType) { () -> Void in - self.present(viewController!, animated: false, completion: { - fromViewControllerSnapshot.removeFromSuperview() - toViewControllerSnapshot.removeFromSuperview() - transitionCompletion?() - }) - } - - case RevealType.unreveal: - - guard let fromViewControllerSnapshot: UIView = - self.view.snapshotView(afterScreenUpdates: true) else { - fatalError("Error to take sel snapshot") - } - - guard let toViewControllerSnapshot: UIView = self.presentingViewController?.view.snapshotView(afterScreenUpdates: true) - ?? self.presentingViewController?.view.snapshotView(afterScreenUpdates: false) else { - self.dismiss(animated: false, completion: { + UIView.animate(withDuration: duration) { + fadeView?.alpha = 1.0 + } + + toViewControllerSnapshot.drawAnimatedCircularMask( + startFrame: rect, + duration: duration, + revealType: revealType) { () -> Void in + self.present(viewController!, animated: false, completion: { transitionCompletion?() + fromViewControllerSnapshot.removeFromSuperview() + toViewControllerSnapshot.removeFromSuperview() + fadeView?.removeFromSuperview() }) - return - } + } - fromViewControllerSnapshot.isOpaque = true - toViewControllerSnapshot.isOpaque = true + case RevealType.unreveal: - fromViewControllerSnapshot.layer.shouldRasterize = true - toViewControllerSnapshot.layer.rasterizationScale = UIScreen.main.scale + guard let fromViewControllerSnapshot: UIView = + self.view.snapshotView(afterScreenUpdates: true) else { + fatalError("Error to take sel snapshot") + } - fromViewControllerSnapshot.layer.shouldRasterize = true - toViewControllerSnapshot.layer.rasterizationScale = UIScreen.main.scale - - self.view?.addSubview(toViewControllerSnapshot) - self.view?.addSubview(fromViewControllerSnapshot) - - fromViewControllerSnapshot.drawAnimatedCircularMask( - startFrame: rect, - duration: duration, - revealType: revealType) { () -> Void in - self.dismiss(animated: false, completion: { - toViewControllerSnapshot.removeFromSuperview() - fromViewControllerSnapshot.removeFromSuperview() - transitionCompletion?() - }) - } - + guard let toViewControllerSnapshot: UIView = self.presentingViewController?.view.snapshotView(afterScreenUpdates: true) + ?? self.presentingViewController?.view.snapshotView(afterScreenUpdates: false) else { + self.dismiss(animated: false, completion: { + transitionCompletion?() + }) + return } - - + + let fadeView: UIView? = buildFadeView(fadeColor, fromViewControllerSnapshot.frame) + fadeView?.alpha = 1.0 + + fromViewControllerSnapshot.isOpaque = true + toViewControllerSnapshot.isOpaque = true + + fromViewControllerSnapshot.layer.shouldRasterize = true + toViewControllerSnapshot.layer.rasterizationScale = UIScreen.main.scale + + fromViewControllerSnapshot.layer.shouldRasterize = true + toViewControllerSnapshot.layer.rasterizationScale = UIScreen.main.scale + + self.view?.addSubview(toViewControllerSnapshot) + if let fadeView: UIView = fadeView { + self.view?.addSubview(fadeView) + } + self.view?.addSubview(fromViewControllerSnapshot) + + UIView.animate(withDuration: duration) { + fadeView?.alpha = 0.01 + } + + fromViewControllerSnapshot.drawAnimatedCircularMask( + startFrame: rect, + duration: duration, + revealType: revealType) { () -> Void in + self.dismiss(animated: false, completion: { + transitionCompletion?() + toViewControllerSnapshot.removeFromSuperview() + fromViewControllerSnapshot.removeFromSuperview() + fadeView?.removeFromSuperview() + }) + } + } } diff --git a/CircularRevealKit/Classes/UIViewRadial.swift b/CircularRevealKit/Classes/UIViewRadial.swift index 78df005..ddf824b 100644 --- a/CircularRevealKit/Classes/UIViewRadial.swift +++ b/CircularRevealKit/Classes/UIViewRadial.swift @@ -32,6 +32,8 @@ public extension UIView { revealType: RevealType, _ completeBlock: (() -> Void)? = nil) { + self.isHidden = false + let maskLayer: CAShapeLayer = CAShapeLayer() let radius: CGFloat = sqrt(pow(frame.size.width, 2) + pow(frame.size.height, 2)) * 2 diff --git a/Example/CircularRevealKit.xcodeproj/project.pbxproj b/Example/CircularRevealKit.xcodeproj/project.pbxproj index 0b19808..001935b 100644 --- a/Example/CircularRevealKit.xcodeproj/project.pbxproj +++ b/Example/CircularRevealKit.xcodeproj/project.pbxproj @@ -218,10 +218,12 @@ TargetAttributes = { 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; + DevelopmentTeam = VZRAFDYUBF; LastSwiftMigration = 1020; }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; + DevelopmentTeam = VZRAFDYUBF; LastSwiftMigration = 1020; TestTargetID = 607FACCF1AFB9204008FA782; }; @@ -444,6 +446,7 @@ baseConfigurationReference = 2CAB5D0EAD8ED2DD994A7FC0 /* Pods-CircularRevealKit_Example.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = VZRAFDYUBF; INFOPLIST_FILE = CircularRevealKit/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; @@ -459,6 +462,7 @@ baseConfigurationReference = 67E82B16E678E51D1D59BD47 /* Pods-CircularRevealKit_Example.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = KM9UHQW6W2; INFOPLIST_FILE = CircularRevealKit/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; @@ -472,6 +476,7 @@ 607FACF31AFB9204008FA782 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = VZRAFDYUBF; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -491,6 +496,7 @@ 607FACF41AFB9204008FA782 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + DEVELOPMENT_TEAM = VZRAFDYUBF; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", diff --git a/Example/CircularRevealKit.xcodeproj/xcshareddata/xcschemes/CircularRevealKit-Example.xcscheme b/Example/CircularRevealKit.xcodeproj/xcshareddata/xcschemes/CircularRevealKit-Example.xcscheme index 972e852..9d8b56a 100644 --- a/Example/CircularRevealKit.xcodeproj/xcshareddata/xcschemes/CircularRevealKit-Example.xcscheme +++ b/Example/CircularRevealKit.xcodeproj/xcshareddata/xcschemes/CircularRevealKit-Example.xcscheme @@ -41,6 +41,15 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -53,17 +62,6 @@ - - - - - - + + + + - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 0.9.1 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 0.9.2 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + diff --git a/README.md b/README.md index 054cb07..473ec16 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ platform :ios, '9.0' use_frameworks! target '' do -pod 'CircularRevealKit', '~> 0.9' +pod 'CircularRevealKit', '~> 0.9.2' end ``` @@ -59,7 +59,7 @@ $ brew install carthage To integrate CircularRevealKit into your Xcode project using Carthage, specify it in your `Cartfile`: ```ogdl -github "T-Pro/CircularRevealKit" ~> 0.9 +github "T-Pro/CircularRevealKit" ~> 0.9.2 ``` Run `carthage update` to build the framework and drag the built `CircularRevealKit.framework` into your Xcode project. @@ -92,6 +92,12 @@ To use with view: view.drawAnimatedCircularMask(startFrame, duration, revealType, completionBlock?) ``` +To include a fade color between the transition, use the fadeColor:` option when presenting or dismisssing the view controller or view. + +```swift +radialPresent(viewController: viewController, fadeColor: UIColor.blue) +``` + ## Example To run the example project, clone the repo, and run `pod install` from the Example directory first.