All Projects → joogps → Slideovercard

joogps / Slideovercard

Licence: mit
A SwiftUI card view, made great for setup interactions.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Slideovercard

Stacklayoutmanager
customized layoutmanager,let item pile up like stackview/类似最美有物卡片堆叠效果
Stars: ✭ 343 (+50.44%)
Mutual labels:  card, slide
KBImageView
UIImageView with Ken Burns effect.
Stars: ✭ 48 (-78.95%)
Mutual labels:  apple, slide
Drawer Behavior
Drawer behavior is a library that provide an extra behavior on drawer, such as, move view or scaling view's height while drawer on slide.
Stars: ✭ 394 (+72.81%)
Mutual labels:  card, slide
react-native-imaged-carousel-card
Fully customizable & Lovely Imaged Carousel Card for React Native
Stars: ✭ 70 (-69.3%)
Mutual labels:  apple, card
Androidpilelayout
An abnormal horizontal ListView-like pile layout with stretch and contraction effects.
Stars: ✭ 2,104 (+822.81%)
Mutual labels:  card, slide
Cardslidepanel
enable users to slide card to the left or right smoothly and continuously
Stars: ✭ 2,377 (+942.54%)
Mutual labels:  card
Hellosilicon
An attempt with ARM64 assembly on Apple Silicon Macs
Stars: ✭ 220 (-3.51%)
Mutual labels:  apple
Zlayoutmanager
Some custom LayoutManager .Such as SwipeCard、FLowLayout。一些自定义的LayoutManager,仿探探、人人影视 炫动滑动 卡片层叠 和流式布局等。
Stars: ✭ 2,404 (+954.39%)
Mutual labels:  card
Mac
macOS Mojave v. 10.14 setup for developers.
Stars: ✭ 209 (-8.33%)
Mutual labels:  apple
Slideimageview
Simple and convenient library that allows you to slide images through a view.
Stars: ✭ 227 (-0.44%)
Mutual labels:  slide
Human Interface Guidelines Extras
Community additions to Apple's Human Interface Guidelines
Stars: ✭ 225 (-1.32%)
Mutual labels:  apple
Rules apple
Bazel rules to build apps for Apple platforms.
Stars: ✭ 217 (-4.82%)
Mutual labels:  apple
Igrphototweaks
Drag, Rotate, Scale and Crop
Stars: ✭ 212 (-7.02%)
Mutual labels:  apple
React Native Header View
Fully customizable Header View with multiple design options for React Native.
Stars: ✭ 221 (-3.07%)
Mutual labels:  apple
Spstorkcontroller
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.
Stars: ✭ 2,494 (+993.86%)
Mutual labels:  apple
Doesitarm
🦾 A list of reported app support for Apple Silicon and the new Apple M1 Macs
Stars: ✭ 3,200 (+1303.51%)
Mutual labels:  apple
Sparkbuttondemo
Demonstrates the Like button animation.
Stars: ✭ 210 (-7.89%)
Mutual labels:  apple
Notificato
Takes care of Apple push notifications (APNS) in your PHP projects.
Stars: ✭ 217 (-4.82%)
Mutual labels:  apple
Apns2
⚡ HTTP/2 Apple Push Notification Service (APNs) push provider for Go — Send push notifications to iOS, tvOS, Safari and OSX apps, using the APNs HTTP/2 protocol.
Stars: ✭ 2,569 (+1026.75%)
Mutual labels:  apple
Rplibs
Refs.cn 原型设计元件库,基于Axure RP 10/9/8,支持 Android、Apple、Windows、微信,移动、桌面平台的应用和网站原型设计。五年历程 2.6k+ star,感谢大家使用。
Stars: ✭ 2,622 (+1050%)
Mutual labels:  apple

SlideOverCard Project logo

Twitter: @joogps

A SwiftUI card design, similar to the one used by Apple in HomeKit, AirPods and Apple Card setup, NFC scanning, Wi-Fi password sharing and more. It is specially great for setup interactions.

Clear Spaces demo QR code scanner demo Example preview demo

From left to right: SlideOverCard being used in Clear Spaces, a QR code scanner prompt (made with https://github.com/twostraws/CodeScanner) and a demo of the project's Xcode preview

Installation

This repository is a Swift package, so all you gotta do is search and include it in your project under File > Swift Package Manager. Then, just add import SlideOverCard to the files where this package will be referenced and you're good to go!

Usage

You can add a card to your app in two different ways. The first one is by adding a .slideOverCard() modifier, which works similarly to a .sheet():

.slideOverCard(isPresented: $isPresented) {
  // Here goes your awesome content
}

Here, $isPresented is a boolean binding. This way you can dismiss the view anytime by setting it to false. This view will have a transition, drag controls and an exit button set by default. You can override this by setting the dragEnabled, dragToDismiss and displayExitButton boolean parameters:

// This creates a card that can't be dragged
.slideOverCard(isPresented: $isPresented, dragEnabled: false) {
}

// This creates a card that can be dragged, but can't be dismissed
.slideOverCard(isPresented: $isPresented, dragToDismiss: false) {
}

// This creates a card with no exit button
.slideOverCard(isPresented: $isPresented, displayExitButton: false) {
}

In case you want to execute code when the view is dismissed (either by the exit button or drag controls), you can also set an optional onDismiss closure parameter:

// This card will print some text when dismissed
.slideOverCard(isPresented: $isPresented, onDismiss: {
    print("I was dismissed")
}) {
}

Alternatively, you can add the card using a binding to an optional or even instantiate it by your own with SlideOverCardView. Please note that this way it won't be automatically positioned in the screen or have transitions.

// This uses a binding to an optional object in a switch statement
.slideOverCard(item: $activeCard) { item in
    switch item {
        case .loginView:
            LoginView()
        default:
            ..........
    }
}
// Using the standalone view
if isPresented {
  SlideOverCardView(isPresented: $isPresented) {
    // Here goes your super-duper cool content
  }
}

Accessory views

This package also includes a few accessory views to enhance your card layout. The first one is the SOCActionButton() button style, which can be applied to any button to give it a default "primary action" look, based on the app's accent color. The SOCAlternativeButton() style will reproduce the same design, but with gray. And SOCEmptyButton() will create an all-text "last option" kind of button. You can use them like this:

Button("Do something", action: {
  ...
}).buttonStyle(SOCActionButton())

There's also the SOCExitButton() view. This view will create the default exit button icon used for the card (based on https://github.com/joogps/ExitButton).

Example

The SwiftUI code for a demo view (which can be seen on the top portion of this page) can be found here. It's an Xcode preview, and you can experience it right within the package folder, under Swift Package Dependencies, in your project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].