SwapperView
public class SwapperView<ViewID> : UIView where ViewID : CustomStringConvertible, ViewID : Hashable
View that is able to swap between 1+ child views.
-
Override
defaultConfigfor this once instance.Declaration
Swift
public var config: SwapperViewConfig { get set } -
Remove all of the previous swapping views and set new ones.
Declaration
Swift
public func setSwappingViews(_ newSwappingViews: [(ViewID, SwappableView)], swapTo: ViewID?) -
Reference the currently shown view, if it’s set.
Declaration
Swift
public private(set) var currentView: (ViewID, SwapperWeakView)? { get } -
All of the views that have been added to this
SwapperView.Note
Seeself.setSwappingViews()to set this.Declaration
Swift
public private(set) var swappingViews: [ViewID : SwapperWeakView] { get } -
Remove the old view that was shown before and show the new view to the screen.
Throws
SwapperError.viewToSwapToNotAddedIf theviewIndicatoris not found inself.swappingViews.Throws
SwapperError.viewToSwapToNoLongerExistsIf theviewIndicatorno longer exists. Probably garbage collected.Declaration
Swift
public func swapTo(_ viewIndicator: ViewID, animate: Bool = true, onComplete: (() -> Void)?) throwsParameters
viewIndicatorView from
self.swappingViewsto swap to.animateTo animate or not.
onCompleteOptional parameter to tell you when the swap animation is complete and the new view is shown.
View on GitHub
SwapperView Class Reference