Download Latest Version Landscape source code.tar.gz (2.3 MB)
Email in envelope

Get an email when there's a new version of SwiftUI Drawer

Home / v0.0.3
Name Modified Size InfoDownloads / Week
Parent folder
Declarative View Modifiers source code.tar.gz 2020-07-16 1.1 MB
Declarative View Modifiers source code.zip 2020-07-16 1.1 MB
README.md 2020-07-16 1.9 kB
Totals: 3 Items   2.3 MB 0

🥳 New Declarative View Modifiers!

Thank you for all your support and feature requests!

New declarative view modifiers will help you customize the drawer experience. Shoutout to u/pupdogg007 for my favorite requested feature: locking the drawer.

I also spent a lot of time refining the fluidity of the drawer animations. In v0.0.2, I made the drags more responsive by toggling animation. In v0.03, after formulating a function on Desmos, I am introducing 'springiness' to the drawers when they are pulled beyond their boundaries. This animation feels more fluid by asymptotically reducing the influence of a drag.

🔒 Locked

Locks the drawer in a controlled position. When set to true, the drawer will animate into the locked height.

Lock into the current resting height

:::swift
/*Drawer*/.locked($locked) { (currentPosition) in
    return currentPosition
}

🪀 Spring

Sets the springiness of the drawer when pulled past boundaries.

The user's drag displacement is transformed by a logistic curve for a natural hard-spring pull that reaches an asymptote.

:::swift
/*Drawer*/.spring(20)

😴 OnRest

A callback to receive updates when the drawer reaches a new resting level. This closure is executed every time the drawer reaches a new resting hieght. Use this when you want to receive updates on the drawer's changes.

:::swift
/*Drawer*/.onRest { (restingHeight) in
    print(restingHeight)
}

💥 Impact

Sets the haptic impact of the drawer when resting

:::swift
/*Drawer*/.impact(.light)

Other Notes

Deprecated the init's impact parameter to prefer the declarative modifier.

Source: README.md, updated 2020-07-16