Retour au classement

Swipe-based paging UI for iOS

iosanimation-libraryswiftuikit
Croissance des étoiles
Étoiles
1.3k
Forks
129
Croissance hebdomadaire
Issues
26
5001k
août 2017juil. 2020juil. 2023juil. 2026
README

SwipeMenuViewController

Platform Swift SPM compatible CI Documentation License

Swipe-based paging UI for iOS: a scrollable tab bar sits above a horizontally paging content area, and swiping the content keeps the tab selection in sync. Use it from UIKit through data source and delegate protocols, or from SwiftUI (iOS 18+) as SwipeMenu with a selection binding.

Segmented Tab & Underline Flexible Tab & Underline Flexible Tab & Circle

Requirements

  • iOS 16.0+ (the SwiftUI SwipeMenu requires iOS 18.0+)
  • Xcode 26.0+ / Swift 6.2+

Need an older toolchain or deployment target? Use the 4.x releases.

Installation

SwipeMenuViewController is distributed with Swift Package Manager. In Xcode, choose File ▸ Add Package Dependencies… and enter the repository URL, or add it to a Package.swift manifest:

dependencies: [
    .package(url: "https://github.com/yysskk/SwipeMenuViewController.git", .upToNextMajor(from: "5.0.0"))
]

Quick Start

UIKit

Subclass SwipeMenuViewController and add your pages as child view controllers. Each child becomes a page: its title is the tab title and its view is the page content.

import SwipeMenuViewController

final class MenuViewController: SwipeMenuViewController {

    override func viewDidLoad() {
        pages.forEach { addChild($0) }
        super.viewDidLoad()
    }

    private let pages: [UIViewController] = {
        let first = UIViewController()
        first.title = "First"
        let second = UIViewController()
        second.title = "Second"
        return [first, second]
    }()
}

To embed the paging UI in a view hierarchy you already have, add a SwipeMenuView directly and drive it through SwipeMenuViewDataSource — the Getting Started article walks through both approaches.

SwiftUI

On iOS 18 and later, use SwipeMenu to drive the same UI from SwiftUI. The selected page is a binding — setting it is the equivalent of jump(to:animated:) — pages come from a view builder, and the appearance is configured with SwipeMenuOptions:

import SwiftUI
import SwipeMenuViewController

struct ContentView: View {

    @State private var selection = 0

    private let titles = ["First", "Second"]

    var body: some View {
        SwipeMenu(selection: $selection, titles: titles) { index in
            Text(titles[index])
                .frame(maxWidth: .infinity, maxHeight: .infinity)
        }
    }
}

The SwipeMenu in SwiftUI article covers the options, the paging callbacks, and the differences from the UIKit view.

Documentation

The full API reference and guides are published with DocC:

Read the documentation →

You can also build the documentation locally in Xcode with Product ▸ Build Documentation, or explore the Example app in this repository (its Xcode project is generated with XcodeGen — see the Example README).

Contributing

Bug reports and pull requests are welcome. See CONTRIBUTING.md for how to build, test, format, and document your changes, then open an issue using one of the templates. Make sure the test suite passes before submitting:

xcodebuild test -scheme SwipeMenuViewController -destination 'platform=iOS Simulator,name=iPhone 16'

Changelog

See CHANGELOG.md for the release history.

License

SwipeMenuViewController is available under the MIT license. See the LICENSE file for details.

Dépôts similaires
flutter/flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

DartBSD 3-Clause "New" or "Revised" Licensemobileandroid
flutter.dev
177.8k30.7k
react/react-native

A framework for building native applications using React

C++MIT Licenseandroidapp-framework
reactnative.dev
126.2k25.2k
facebook/react-native

A framework for building native applications using React

C++MIT Licenseandroidapp-framework
reactnative.dev
120.9k24.5k
rustdesk/rustdesk

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

Rustcrates.ioGNU Affero General Public License v3.0remote-controlremote-desktop
rustdesk.com
118.6k18.1k
justjavac/free-programming-books-zh_CN

:books: 免费的计算机编程类中文书籍,欢迎投稿

GNU General Public License v3.0pythonjavascript
weibo.com/justjavac
117.7k28.2k
Solido/awesome-flutter

An awesome list that curates the best Flutter libraries, tools, tutorials, articles and more.

Dartflutterawesome-list
60.7k6.9k
FiloSottile/mkcert

A simple zero-config tool to make locally trusted development certificates with any names you'd like.

GoGo ModulesBSD 3-Clause "New" or "Revised" Licensehttpstls
mkcert.dev
59.3k3.1k
ultralytics/yolov5

Ultralytics YOLOv5 in PyTorch > ONNX > CoreML > TFLite

PythonPyPIGNU Affero General Public License v3.0yolov3yolov5
docs.ultralytics.com
57.7k17.5k
appwrite/appwrite

Appwrite® - complete cloud infrastructure for your web, mobile and AI apps. Including Auth, Databases, Storage, Functions, Messaging, Hosting, Realtime and more

TypeScriptnpmBSD 3-Clause "New" or "Revised" Licenseappwritedocker
appwrite.io
56.6k5.6k
google/material-design-icons

Material Design icons by Google (Material Symbols)

Apache License 2.0materialmaterial-design
google.github.io/material-design-icons/
53.6k9.7k
vsouza/awesome-ios

A curated list of awesome iOS ecosystem, including Objective-C and Swift Projects

SwiftMIT Licenseawesomeswift-library
awesomeios.dev
52.8k7k
ionic-team/ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

TypeScriptnpmMIT Licenseionicmobile
ionicframework.com
52.6k13.3k