FlipKit is a SwiftUI library with a FlipView
component that works on all major Apple platforms.
The FlipView
component can be customized with custom content views, flip durations, flip directions, etc.
FlipKit can be installed with the Swift Package Manager:
https://github.com/danielsaidi/FlipKit.git
You can become a sponsor to help me dedicate more time on my various open-source tools. Every contribution, no matter the size, makes a real difference in keeping these tools free and actively developed.
With FlipKit's FlipView
, you just have to provide a front and back view:
import FlipKit
struct MyView: View {
@State private var isFlipped = false
var body: some View {
FlipView(
isFlipped: $isFlipped,
flipDuration: 1.0,
tapDirection: .right,
flipDirections: [.left, .right, .up, .down],
front: { Card(color: .green) },
back: { Card(color: .red) }
)
.flipViewAnimation(.linear, duration: 1.0)
.withListRenderingBugFix() // Use this when in a List
}
}
struct Card: View {
let color: Color
var body: some View {
color.cornerRadius(10)
}
}
You can flip the view programatically by just toggling isFlipped
with code.
The online documentation has more information, articles, code examples, etc.
The Demo
folder has a demo app that lets you explore the library and integrate with a few APIs.
Feel free to reach out if you have questions, or want to contribute in any way:
- Website: danielsaidi.com
- E-mail: [email protected]
- Bluesky: @[email protected]
- Mastodon: @[email protected]
FlipKit is available under the MIT license. See the LICENSE file for more info.