• Stars
    star
    705
  • Rank 62,182 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A customizable Snapping Drawer à la Apple Maps.

 100% in SwiftUI.

Snap

A customizable Snapping Drawer à la Apple Maps, Apple Music, Stocks, Overcast, etc.. 100% in SwiftUI

This is heavily inspired by Rideau and based on this Gist by mshafer.

Here's a short demo where I reconstructed the Apple Maps UI:

Installation

Swift Package Manager

You can install Snap via Swift Package Manager by adding the following line to your Package.swift:

import PackageDescription

let package = Package(
    [...]
    dependencies: [
        .package(url: "https://github.com/nerdsupremacist/Snap.git", from: "0.1.0")
    ]
)

Usage

Snap allows you to set up either 1, 2 or 3 Snapping points and customize your UI depending on where you are.

For example if we want to recreate the Apple Maps UI we could write the following:

import MapKit
import Snap
import SwiftUI

struct ContentView: View {
    @State private var region = MKCoordinateRegion(...)

    var body: some View {
        ZStack {
            Map(coordinateRegion: $region)

            SnapDrawer(large: .paddingToTop(24), medium: .fraction(0.4), tiny: .height(100), allowInvisible: false) { state in
                VStack(alignment: .leading, spacing: 10) {
                    SearchBar()

                    if state != .tiny {
                        Favorites()
                            .transition(.scale)
                    }

                    if state == .large {
                        Recents()
                            .transition(.scale)
                    }
                }
            }
        }
    }
}

Feel free to explore the API yourself and play around with it.

Other features include:

  • Listening to state changes via a @Binding
  • Setting a background view

Contributions

Contributions are welcome and encouraged!

License

Snap is available under the MIT license. See the LICENSE file for more info.

More Repositories

1

FancyScrollView

A SwiftUI ScrollView Designed to imitate the App Store and Apple Music ScrollViews (with or without a Parallax Header)
Swift
931
star
2

Graphaello

A Tool for Writing Declarative, Type-Safe and Data-Driven Applications in SwiftUI using GraphQL
Swift
494
star
3

Sync

Real-time Apps the SwiftUI way
Swift
155
star
4

Syntax

Write value-driven parsers quickly in Swift with an intuitive SwiftUI-like DSL
Swift
146
star
5

GraphZahl

A Framework to implement Declarative, Type-Safe GraphQL Server APIs using Runtime Magic 🎩
Swift
143
star
6

CovidUI

A simple App to Track the status of Covid-19 around the World. Using SwiftUI and GraphQL
Swift
78
star
7

memes

An online Multi-Player Meme Party Game written in Swift
Swift
68
star
8

Valid

Input Validation Done Right. A Swift DSL for Validating User Input using Allow/Deny Rules
Swift
37
star
9

CovidQL

GraphQL API for querying data related to Covid-19
Swift
31
star
10

StopTouchingYourFace

SwiftUI App that alerts you when you have touched your face
Swift
25
star
11

tmdb

A GraphQL Wrapper for The Movie Database
Swift
24
star
12

Sweeft

Swift but a bit Sweeter - More Syntactic Sugar for Swift #MakeSwiftGreatAgain
Swift
21
star
13

Fuzzi

Locally searching in Swift made simple (and fuzzily)
Swift
19
star
14

AssociatedTypeRequirementsKit

A Swift µFramework for dealing with the classic "Self or associated type requirements" errors
Swift
18
star
15

git-yolo

YOLO Mode for GIT
JavaScript
16
star
16

VariadicViewBuilder

Custom View Builder that allows you to build custom layouts
Swift
15
star
17

trumpify

Make your words be the BEST WORDS - Instant text trumpifier
JavaScript
14
star
18

VideoPlayer

µFramework containing a SwiftUI Video Player allowing for custom controls
Swift
13
star
19

Protected

Experimental API for Reads and Writes protected via Phantom types
Swift
11
star
20

LlamaLang

Repository for the Llama Programming Language. Work In Progress
Python
11
star
21

graphzahl-todo-app-example

Example Todo App Showcasing how to use GraphZahl with Vapor and Fluent
Swift
7
star
22

SyncExampleApp

Example App on how to use Sync to keep objects in sync
Swift
7
star
23

SyncTokamak

Swift
6
star
24

syntax-highlight-publish-plugin

Plugin to add syntax highlighting (for multiple languages) to your Publish Site, with the least amount of effort.
Swift
6
star
25

graphzahl-vapor-support

A set of extensions that allow to use GraphZahl with Vapor
Swift
6
star
26

GridView

A SwiftUI View that allows you to Render items in a Grid
Swift
5
star
27

tmdb-relay-test

Test Project showcasing Relay + Typescript + GitHub Actions + Chakra
TypeScript
5
star
28

Mealy

Swift Framework for Model-Based Testing using Mealy Machines
Swift
5
star
29

stalky-app

Always remember people's names
Swift
5
star
30

CodableEnum

µFramework that allows you to make an Enum with associated values conform to Codable
Swift
5
star
31

SyncWebSocketVapor

Web Socket Server Support for Sync
Swift
4
star
32

Pushie

Push Down Automata Creation in Swift. The easy way.
Swift
4
star
33

git-fuck

NPM Module for when you've committed to the wrong branch
JavaScript
4
star
34

Assert

Swift UI Like DSL for Building Tests
Swift
4
star
35

MarkdownSyntax

Markdown Parser using Syntax
Swift
4
star
36

graphaello-music-example

Example App using Graphaello
Swift
4
star
37

graphzahl-fluent-support

A set of extensions that allow to use Fluent APIs with GraphZahl
Swift
4
star
38

fresh-mac-setup

How to set up a fresh Mac the way I like it
Ruby
3
star
39

SyntaxTree

Model for building Syntax Trees
Swift
3
star
40

graphql-syntax

GraphQL Parser written in Syntax
Swift
3
star
41

graphaello-countries-example

Example App using Graphaello
Swift
3
star
42

GraphDSL

Script that given a GraphQL Server will create a Kotlin DSL for writing queries
Kotlin
2
star
43

graphzahl-vs-graphiti

Comparison of the same schema implemented with GraphZahl and with Graphiti as a comparison
Swift
1
star
44

SyncWebSocketWebAssemblyClient

Swift
1
star
45

ContextKit

A Public Basic API for providing a Compositable Type Safe Dict
Swift
1
star
46

SyncWebSocketClient

Web Socket Client support for Sync
Swift
1
star
47

kotlin-worldbank-type-provider

Type Provider for the WorldBank API inside of Kotlin Scripting
Kotlin
1
star
48

syntax-highlight

Syntax Highlighting Extensions to the Syntax Framework
Swift
1
star
49

kotlin-type-provider-template

Template for building Type Providers for Kotlin Scripting
Kotlin
1
star
50

TextMate

Support for parsing Text Mate Languages
Swift
1
star
51

StarWarsArray

A Swift Sequence indexed like Star Wars Movies
Swift
1
star
52

isAdnanGonnaBeLate

A simple Web Page with the Status of whether or not Adnan Will be Late
HTML
1
star