Swipe between pages with an interactive title navigation control. Configure horizontal or vertical chains for unlimited pages amount.

Overview

LOGO

Language Build Status codecov.io Version License Platform

SlideController is a simple and flexible UI component fully written in Swift. Built using power of generic types, it is a nice alternative to UIPageViewController.

Horizontal Vertical Carousel

Requirements

  • iOS 9.0+
  • Xcode 10.2+
  • Swift 5.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate SlideController into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'SlideController'
end

Then, run the following command:

$ pod install

Usage

import SlideController
  1. Create content
let content = [
            SlideLifeCycleObjectBuilder<PageLifeCycleObject>(),
            SlideLifeCycleObjectBuilder<PageLifeCycleObject>(),
            SlideLifeCycleObjectBuilder<PageLifeCycleObject>()
        ]
  • PageLifeCycleObject is any object conforms to Initializable, Viewable, SlidePageLifeCycle protocols
  1. Initialize SlideController
slideController = SlideController<CustomTitleView, CustomTitleItem>(
    pagesContent: content,
    startPageIndex: 0,
    slideDirection: .horizontal)
  • CustomTitleView is subclass of TitleScrollView<CustomTitleItem>
  • CustomTitleItem is subclass of UIView and conforms to Initializable, ItemViewable, Selectable protocols
  1. Add slideController.view to view hierarchy

  2. Call slideController.viewDidAppear() and slideController.viewDidDisappear() in appropriate UIViewController methods:

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    slideController.viewDidAppear()
}
override func viewDidDisappear(_ animated: Bool) {
   super.viewDidDisappear(animated)
   slideController.viewDidDisappear()
}

Documentation

SlideController

Default initializer of SlideController.
pagesContent - initial content of controller, can be empty.
startPageIndex - page index that should be displayed initially.
slideDirection - slide direction. .horizontal or .vertical.

public init(pagesContent: [SlideLifeCycleObjectProvidable],
            startPageIndex: Int = 0,
            slideDirection: SlideDirection)

Returns titleView instanсe of TitleScrollView.

public var titleView: T { get }

Returns LifeCycleObject for currently displayed page.

public var currentModel: SlideLifeCycleObjectProvidable? { get }

Returns array of LifeCycleObject that corresponds to SlideController's content.

public private(set) var content: [SlideLifeCycleObjectProvidable]

When set to true unloads content when it is out of screen bounds. The default value is true.

public var isContentUnloadingEnabled: Bool { get set }

When set to true scrolling in the direction of last item will result jumping to the first item. Makes scrolling infinite. The default value is false.

public var isCarousel: Bool { get set }

If the value of this property is true, content scrolling is enabled, and if it is false, content scrolling is disabled. The default is true.

public var isScrollEnabled: Bool { get set }

Appends pages array of SlideLifeCycleObjectProvidable to the end of sliding content.

public func append(object objects: [SlideLifeCycleObjectProvidable])

Inserts SlideLifeCycleObjectProvidable page object at index in sliding content.

public func insert(object: SlideLifeCycleObjectProvidable, index: Int)

Removes a page at index.

public func removeAtIndex(index: Int)

Slides content to page at pageIndex with sliding animation if animated is set to true. Using forced is not recommended, it will perform shift even if other shift animation in progress or pageIndex equals current page. The default value of animated is true. The default value of forced is false.

public func shift(pageIndex: Int, animated: Bool = default, forced: Bool = default)

Slides content the next page with sliding animation if animated is set to true. The default value of animated is true.

public func showNext(animated: Bool = default)

Lets the SlideController know when it is displayed on the screen. Used for correctly triggering LifeCycle events.

public func viewDidAppear()

Lets the SlideController know when it is not displayed on the screen. Used for correctly triggering LifeCycle events.

public func viewDidDisappear()

TitleScrollView

Alignment of title view. Supports .top, .bottom, .left, .right. The default value of alignment is .top.

public var alignment: SlideController.TitleViewAlignment { get set }

The size of TitleScrollView. For .horizontal slide direction of SlideController the titleSize corresponds to height. For .vertical slide direction of SlideController the titleSize corresponds to width. The default value of titleSize is 84.

open var titleSize: CGFloat { get set }

Array of title items that displayed in TitleScrollView.

open var items: [TitleItem] { get }

You might also like...
UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.
UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.

MultiSlider UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizo

Useful for showing text or custom view tags in a vertical or horizontal scrollable view and support Autolayout at the same time
Useful for showing text or custom view tags in a vertical or horizontal scrollable view and support Autolayout at the same time

Useful for showing text or custom view tags in a vertical or horizontal scrollable view and support Autolayout at the same time. It is highly customizable that most features of the text tag can be configured.

Horizontal and Vertical collection view for infinite scrolling that was designed to be used in SwiftUI
Horizontal and Vertical collection view for infinite scrolling that was designed to be used in SwiftUI

InfiniteScroller Example struct ContentView: View { @State var selected: Int = 1 var body: some View { InfiniteScroller(direction: .ve

A simple yet customizable horizontal and vertical picker view
A simple yet customizable horizontal and vertical picker view

WheelPicker A simple yet customizable horizontal and vertical picker view Features Vertical or Horizontal picker Image or Text data Configure UILabel

Allows trendy transitions using swipe gesture such as
Allows trendy transitions using swipe gesture such as "swipe back anywhere".

SwipeTransition allows trendy transitions using swipe gesture such as "swipe back". Try the demo on the web (appetize.io):γ€€https://appetize.io/app/peb

Transition from any SwiftUI Text view into an inline navigation bar title when the view is scrolled off-screen, as seen in Apple's TV & TestFlight iOS apps.
Transition from any SwiftUI Text view into an inline navigation bar title when the view is scrolled off-screen, as seen in Apple's TV & TestFlight iOS apps.

SwiftUI Matched Inline Title Transition from any SwiftUI Text view into an inline navigation bar title when the view is scrolled off-screen, as seen i

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.

Power! Unlimited power for ARKit 2.0!
Power! Unlimited power for ARKit 2.0!

A long time ago in a galaxy, far, far away... It is a period when iPhone SE and iPhone X were destroyed from the apple store, the AR market was under

An alternative SwiftUI NavigationView implementing classic stack-based navigation giving also some more control on animations and programmatic navigation.
An alternative SwiftUI NavigationView implementing classic stack-based navigation giving also some more control on animations and programmatic navigation.

swiftui-navigation-stack An alternative SwiftUI NavigationView implementing classic stack-based navigation giving also some more control on animations

The horizontal swiping navigation like on Facebook Messenger.
The horizontal swiping navigation like on Facebook Messenger.

UIMenuScroll UIMenuScroll creating menu how on Facebook Messenger on take photo Installation CocoaPods is a dependency manager for Cocoa projects. You

UITabBarController with swipe interaction between its tabs.
UITabBarController with swipe interaction between its tabs.

🌟 Features Zero setup Different animations Enable/Disable interactions easily Fluid gestures πŸ“² Installation Using CocoaPods Edit your Podfile and sp

Instagram clone, the main focus of the app is the seamless swipe between views that we see on instagram
Instagram clone, the main focus of the app is the seamless swipe between views that we see on instagram

InstaSwipe Instagram clone, the main focus of the app is the seamless swipe betw

A Credit Amount and EMI User Interface build in Swift and SwiftUI
A Credit Amount and EMI User Interface build in Swift and SwiftUI

App Usage An iPhone application build in swift . Overview Supported on All iPhone Screen Sizes Dynamic Data following MVVM Design Pattern Used Transit

Stopwatch is a Swift App that measures amount of time elapsed from a particular time.
Stopwatch is a Swift App that measures amount of time elapsed from a particular time.

Stopwatch Stopwatch is a Swift App that measures amount of time elapsed from a particular time. It highly mocks the stopwatch of Apple's offical App c

A precise, type-safe representation of a monetary amount in a given currency

Money A precise, type-safe representation of monetary amounts in a given currency. This functionality is discussed in Chapter 3 of Flight School Guide

🌊 - Jelly is a library for animated, non-interactive & interactive viewcontroller  transitions and presentations with the focus on a simple and yet flexible API.
🌊 - Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexible API.

Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexibl

🌊 - Jelly is a library for animated, non-interactive & interactive viewcontroller  transitions and presentations with the focus on a simple and yet flexible API.
🌊 - Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexible API.

Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexibl

VerticalSlider is a vertical slider control for iOS in Swift.
VerticalSlider is a vertical slider control for iOS in Swift.

🎚 VerticalSlider If you like VerticalSlider, give it a β˜… at the top right of this page. Overview VerticalSlider is a vertical implementation of the U

Comments
  • Fixed titles mode

    Fixed titles mode

    Title shift mode added (TitleShiftMode). It can be used to specify other titles animation behavior then centered position. .paged mode added. It works almost same with .center but adjusts title position to match title border with titles superview border.

    Used only for X axis titles layout.

    opened by oroom 5
  • Improved example

    Improved example

    Issue https://github.com/touchlane/SlideController/issues/54

    • remove current page instead of the first one on remove action
    • keep indexing pages to make visually clear what page inserted, appended or removed
    opened by pkandrashkou 1
  • Sync life cycle calls

    Sync life cycle calls

    Fix for https://github.com/touchlane/SlideController/issues/44 Related to https://github.com/touchlane/SlideController/issues/36 Added common callback for sliding end animation via user slide or shift. So there is no need in checking if content has reached the page's edge. With that the didAppear life cycle will be called slightly after animation ends.

    opened by pkandrashkou 1
Releases(1.5.1)
  • 1.5.1(Feb 12, 2020)

  • 1.5.0(Nov 12, 2018)

  • 1.4.0(Sep 19, 2018)

  • 1.3.5(Sep 19, 2018)

  • 1.3.4(Aug 1, 2018)

  • 1.3.3(Aug 1, 2018)

  • 1.3.2(Feb 28, 2018)

  • 1.3.1(Feb 22, 2018)

    Changelog for SlideController 1.3.1

    Example changes

    • insertAction now inserts a page before currently selected page for both vertical and horizontal samples.
    • removeAction now deletes current page for vertical sample as well as for horizontal.
    Source code(tar.gz)
    Source code(zip)
  • 1.3.0(Feb 21, 2018)

    Changelog for SlideController 1.3.0

    Added

    • New example look πŸŽ‰ .

    Breaking Change

    • isCircular renamed to isCarousel.

    Fixed

    • Select title item after insert(object: SlideLifeCycleObjectProvidable, index: Int).
    Source code(tar.gz)
    Source code(zip)
  • 1.2.2(Feb 13, 2018)

    Changelog for SlideController 1.2.2

    Fixed

    • isScrollEnabled exposed to public api as intended.
    • currentIndex calculation for not layouted views.
    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(Jan 12, 2018)

  • 1.2.0(Jan 4, 2018)

    Changelog for SlideController 1.2.0

    Added

    • isCircular setting that enables infinite scroll between pages.
    • TitleViewAlignment enum extended with bottom option.
    • Carousel sample added to example project.

    Fixed

    • Views unloading on manual shift(pageIndex:, animated:) call
    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Dec 27, 2017)

  • 1.1.0(Nov 30, 2017)

    Changelog for SlideController 1.1.0

    Added

    • Breaking Change SlidePageModel renamed to SlideLifeCycleObjectBuilder.
    • Callback method func indicator(position: CGFloat, size: CGFloat, animated: Bool) in TitleScrollView to implement sliding indicator.
    • Sliding indicator HorizontalTitleScrollView sample.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.4(Nov 27, 2017)

  • 1.0.3(Nov 21, 2017)

    Changelog for SlideController 1.0.3

    Added

    • isContentUnloadingEnabled setting that allows disable pages unloading

    Fixed

    • SlidePageLifeCycle calls on insert(object:, index:)
    • SlidePageLifeCycle calls on shift(pageIndex:, animated:)
    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Nov 16, 2017)

    Changelog for SlideController 1.0.2

    Added

    • Unit tests

    Fixed

    • SlidePageLifeCycle calls on removeViewAtIndex(index:)
    • SlidePageLifeCycle calls when appended pages to empty SlideController
    • Duplicated didStartSliding calls
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Nov 3, 2017)

    Changelog for SlideController 1.0.1

    Fixed

    • Inappropriate lifecycle calls when SlideController appears.
    • View loading on slideController.shift(pageIndex: Int, animated: Bool).
    • Lifecycle didStartSliding calls on page transition.
    • Layouting SlideContentView in changeContentLayoutAction when changing device orientation.
    • Crash calculating currentIndex when contentSize of a page is 0.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Nov 3, 2017)

    Changelog for SlideController 1.0.0

    Added

    • Vertical SlideController implementation.
    • Smart transition - skipping intermediate pages.
    • SlideContentView lazy loading.
    • SlideContentView unloading.
    • FeatureManager for feature toggling.
    • ActionsView for both vertical and horizontal example.
    • Device orientation support.
    • TitleItemObject auto selection when it is out of the screen while sliding.
    • Lock TitleView for scrolling and selection while SlideController's is sliding.

    Fixed

    • ScrollView automatically adjusted contentInsets.
    Source code(tar.gz)
    Source code(zip)
Owner
Touchlane
Making custom software for you
Touchlane
This is a control that helps you dramatically ease your infinite scroll processing.

InfiniteScrollControl Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installat

Minseok Kang 0 Nov 15, 2021
Swipe between pages with an interactive title navigation control. Configure horizontal or vertical chains for unlimited pages amount.

SlideController is a simple and flexible UI component fully written in Swift. Built using power of generic types, it is a nice alternative to UIPageVi

Touchlane 411 Jan 5, 2023
The elegant yet functional dropdown menu, written in Swift, appears underneath the navigation bar to display a list of defined items when a user clicks on the navigation title.

Introduction The elegant yet functional dropdown menu, written in Swift, appears underneath the navigation bar to display a list of defined items when

Tho Pham 2.7k Dec 28, 2022
Text entry controls which contain a built-in title/label so that you don't have to add a separate title for each field.

FloatLabelFields Overview Installation Via Interface Builder Via Code Credits Additional References Questions Overview FloatLabelFields is the Swift i

Fahim Farook 1.2k Jan 4, 2023
SwiftUI view enabling navigation between pages of content, imitating the behaviour of UIPageViewController for iOS and watchOS

PageView SwiftUI view enabling page-based navigation, imitating the behaviour of UIPageViewController in iOS. Why SwiftUI doesn't have any kind of pag

Kacper RΔ…czy 365 Dec 29, 2022
RCalendarPicker A date picker control, Calendar calendar control, select control, calendar, date selection, the clock selection control.

RCalendarPicker RCalendarPicker Calendar calendar control, select control, calendar, date selection, the clock selection control. ζ—₯εŽ†ζŽ§δ»Ά ,ζ—₯εŽ†ι€‰ζ‹©ζŽ§δ»ΆοΌŒζ—₯εŽ†οΌŒζ—₯ζœŸι€‰ζ‹©

ζœθ€€θΎ‰ 131 Jul 18, 2022
UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.

MultiSlider UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizo

Yonat Sharon 326 Dec 29, 2022
BMPlayer - A video player for iOS, based on AVPlayer, support the horizontal, vertical screen

A video player for iOS, based on AVPlayer, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, support subtitles.

Eliyar Eziz 1.8k Jan 4, 2023
Easily add vertical and horizontal pull to refresh to any UIScrollView. Can also add multiple pull-to-refesh views at once.

This is a fork from the famous SVPullToRefresh pod with 2 additional functionalities: Can add multiple pull-to-refresh views into one single UIScrollV

Hoang Tran 42 Dec 28, 2022
A structured vertical/horizontal stack layout

EEStackLayout A vertical stackview which takes subviews with different widths and adds them to it's rows with paddings, spacings etc. Installation Coc

null 48 Nov 6, 2021