Swiftpack.co -  sameersyd/FortuneWheel as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
sameersyd/FortuneWheel
Fortune spinning wheel library built using SwiftUI, supports dynamic content.
.package(url: "https://github.com/sameersyd/FortuneWheel.git", from: "0.1.4")

CI Status Version License Platform

GitHub Cards Preview

Fortune Wheel

Fortune spinning wheel 🎡 library built using SwiftUI, supports dynamic content.


Preview - Spin Wheel ⚙️

gif


CocoaPods Installation

FortuneWheel is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'FortuneWheel'

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/sameersyd/FortuneWheel.git", .upToNextMajor(from: "0.1.4"))
]

Sample Code 🌟

Import Fortune Wheel in your file

import FortuneWheel
struct ContentView: View {
	var players = ["Sameer", "Spikey", "Amelia", "Joan", "Karen", "Natalie"]
	var body: some View {
		ZStack {
			FortuneWheel(titles: players, size: 320, onSpinEnd: { index in
				// your action here - based on index
			})
		}
	}
}

Note:

When custom animation is used, provide it's duration in animDuration parameter

Change the animDuration only if custom animation is used, or it may cause delay in pointer result.


Fortune Wheel properties

Parameter Optional Type Default Value
titles false [String] nil
size false CGFloat nil
onSpinEnd false (Int) -> () nil
colors true [Color] Color hex ["FBE488", "75AB53", "D1DC59", "EC9D42", "DE6037", "DA4533", "992C4D", "433589", "4660A8", "4291C8"]
pointerColor true Color Color(hex: "DA4533")
strokeWidth true CGFloat 15
strokeColor true Color Color(hex: "252D4F")
animDuration true Double 6
animation true Animation Animation.timingCurve(0.51, 0.97, 0.56, 0.99, duration: 6)

UI Design 🎨

The UI for this Fortune Wheel library was designed by @Spikeysanju


Contribute

If you want to contribute to this app, you're always welcome! See Contributing Guidelines.


Donation

If this project helped you reduce time to develop, you can buy me a cup of coffee :)

Buy Me A Coffee


Author

Sameer Nawaz, sameer.nwaz@gmail.com


License

    Apache 2.0 License


    Copyright 2021 Sameer Nawaz

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

GitHub

link
Stars: 21
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Fortune Wheel
2 weeks ago
  • Fix SPM warnings
  • Fix 0.1.3 CocoaPod source

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API