This article will explore the design process behind a UI component written in Swift. The component, which is called an “AppBar”, is one of the most commonly used features in iOS apps. It’s also flexible enough to be used across many different app types and scenarios.
The swift component library is a simple and flexible UI component fully written in Swift. It has been created by the team at YC-backed startup, Avocado.
SlideController is a simple and adaptable UI component built entirely in Swift. It’s a great alternative to UIPageViewController since it’s built using the power of generic types.
- iOS 9.0+
- Xcode 10.2+ is required.
- Swift 5.0 and up
CocoaPods is a Cocoa project dependency management. You may use the following command to install it:
cocoapods $ gem install
To use CocoaPods to incorporate SlideController into your Xcode project, add the following to your Podfile:
target ” do pod ‘SlideController’ end source ‘https://github.com/CocoaPods/Specs.git’ platform :ios, ‘9.0’ use frameworks!
Run the following command after that:
$ install pod
SlideController is imported.
- Produce content
let content = [ SlideLifeCycleObjectBuilder(), SlideLifeCycleObjectBuilder(), SlideLifeCycleObjectBuilder(), SlideLifeCycleObjectBuilder(), SlideLifeCycleObjectBuilder(), SlideLifeCycleObjectBuilder(), SlideLifeCycleObjectBuilder(), SlideLifeC
- Any object that complies with Initializable, Viewable, and Slide is a PageLifeCycleObject. Protocols for the PageLifeCycle
- SlideController should be initialized.
CustomTitleView, CustomTitleItem> slideController = SlideController ( slideDirection:.horizontal, startPageIndex: 0, pagesContent: content)
- CustomTitleView is a TitleScrollView subclass.
- CustomTitleItem is a UIView subclass that follows the Initializable, ItemViewable, and Selectable protocols.
SlideController should be added. hierarchy from view to view
Make a call to slideController. slideController.viewDidDisappear() and viewDidAppear() in relevant UIViewController methods:
override the function view super.view DidAppear(_ animated: Bool) slideController.view.DidAppear(animated) DidAppear() is a function that checks if anything has appeared. override view func super.view DidDisappear(_ animated: Bool) slideController.view DidDisappear(animated) DidDisappear() is a function that checks if something has vanished.
SlideController’s default initializer. pagesContent – the controller’s initial content, which may be empty. start PageIndex – the page index that should be shown first. slide .horizontal or.vertical is the slide direction.
public init(pagesContent: [SlideLifeCycleObjectProvidable], startPageIndex: Int = 0, slideDirection: SlideDirection), startPageIndex: Int = 0, slideDirection: SlideDirection)
Returns a TitleScrollView object named titleView.
public var titleView: T obj obj obj obj obj obj
The current page’s LifeCycleObject is returned.
currentModel: SlideLifeCycleObjectProvidable? public var currentModel: SlideLifeCycleObjectProvidable? obtain
Returns an array of LifeCycleObjects that correspond to the content of the SlideController.
var content: [SlideLifeCycleObjectProvidable] public private(set)
When set to true, content is unloaded when it reaches the edge of the screen. True is the default setting.
isContentUnloadingEnabled: public var Get ready to bool bool bool bool bool bool bool
When true is selected, scrolling in the direction of the last item results in a leap to the first item. Allows for endless scrolling. False is the default setting.
isCarousel: Bool get set public var isCarousel: Bool get set public var isCarousel: Bool get set public var is
Content scrolling is enabled if the value of this attribute is true, and it is disabled if the value is false. True is the default setting.
isScrollEnabled: Bool get set public var isScrollEnabled: Bool get set public var isScrollEnabled: Bool get set public
SlideLifeCycleObjectProvidable pages array is appended to the end of the sliding content.
append public func (object objects: [SlideLifeCycleObjectProvidable])
SlideLifeCycleObjectProvidable page object is inserted at index in the sliding content.
insert public func (object: SlideLifeCycleObjectProvidable, index: Int)
Deletes a page from the index.
removeAtIndex is a public func (index: Int)
If animated is set to true, the content is slid to the page at pageIndex with a sliding motion. Forced is not advised since it will shift even if there is another shift animation running or if pageIndex equals current page. The animated property’s default value is true. Forced is set to false by default.
pageIndex: Int, animated: Bool = default, forced: Bool = default) public func shift(pageIndex: Int, animated: Bool = default, forced: Bool = default)
If animated is set to true, it slides the content to the next page with a sliding motion. The animated property’s default value is true.
showNext(animated: Bool = default) is a public func.
When the SlideController is shown on the screen, this property is set to true. Used to ensure that LifeCycle events are properly triggered.
viewDidAppear is a public func ()
When the SlideController is not visible on the screen, this method informs it. Used to ensure that LifeCycle events are properly triggered.
viewDidDisappear is a public func ()
View of the title is aligned. .top,.bottom,.left, and.right are all supported. The default alignment value is.top.
SlideController.TitleViewAlignment is a public var that may be set.
The TitleScrollView’s size. The titleSize of SlideController’s horizontal slide direction matches to height. The titleSize of the SlideController.vertical slide direction matches to the width. titleSize is set to 84 by default.
get set var titleSize: CGFloat var titleSize: CGFloat var titleSize: CGFloat var titleSize: CGFlo
TitleScrollView displays an array of title elements.
open var items: [TitleItem] get var items: [TitleItem] get var items: [TitleItem] get var items:
The swift libraries 2020 is a simple and flexible UI component fully written in Swift. It can be used for anything from games to social media apps.
- swift libraries list
- swiftui components
- awesome swiftui
- awesome ios animation
- awesome ios github