项目作者: kieranb662

项目描述 :
Utilities for working with bezier curves in SwiftUI
高级语言: Swift
项目地址: git://github.com/kieranb662/SwiftUI-bez.git
创建时间: 2020-03-21T23:08:44Z
项目社区:https://github.com/kieranb662/SwiftUI-bez

开源协议:MIT License

下载





SwiftUI
Swift 5.1
Swift 5.1
kieranb662 followers

Bez is a swift package aimed at making Bézier curves easy to work with and manipulate.

Try out all that bez has to offer by creating your own shapes using the bez editor app available for free on iOS 13.4 and greater.





The various utilities included are:

  • Interpolation Functions
  • Derivatives
  • Arc Lengths
  • Segmentation
  • Subdivision
  • Lookup Table Generation
  • Path Description -> Normalized SwiftUI Shape Conversion

Quick Start

  1. Snag that URL from the github repo
  2. In Xcode -> File -> Swift Packages -> Add Package Dependencies
  3. Paste the URL Into the box
  4. Specify the minimum version number (1.0.5)
  5. Copy/Paste the following snippet Into The ContentView.swift file
  1. import SwiftUI
  2. import bez
  3. struct ContentView: View {
  4. @ObservedObject var polybezier: PolyBezier = PolyBezier(Circle().path(in: .init(x: 50, y: 100, width: 100, height: 100)))
  5. var body: some View {
  6. NavigationView {
  7. PathEditor(polybezier: _polybezier, name: "Shape",
  8. save: { (name , path) in print(path)})
  9. .navigationBarTitle("Bez Editor", displayMode: .inline)
  10. }
  11. }
  12. }
  13. struct ContentView_Previews: PreviewProvider {
  14. static var previews: some View {
  15. ContentView().colorScheme(.dark)
  16. }
  17. }

Mathematical Background

bez Info

Example Uses

The PSlider component of the Sliders SwiftUI Library


Path Slider Gif