Skip to content

Commit

Permalink
Update podspec
Browse files Browse the repository at this point in the history
  • Loading branch information
sameersyd committed Apr 8, 2021
1 parent b3408f5 commit 53625b5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions FortuneWheel.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

Pod::Spec.new do |s|
s.name = 'FortuneWheel'
s.version = '0.1.1'
s.summary = 'A FortuneWheel library for iOS using SwiftUI'
s.version = '0.1.2'
s.summary = 'Fortune spinning wheel library built using SwiftUI, supports dynamic content'

# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
Expand All @@ -18,11 +18,11 @@ Pod::Spec.new do |s|
# * Finally, don't worry about the indent, CocoaPods strips it!

s.description = <<-DESC
'A FortuneWheel library for iOS using SwiftUI'
'Fortune spinning wheel library built using SwiftUI, supports dynamic content'
DESC

s.homepage = 'https://github.com/sameersyd/FortuneWheel'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.license = { :type => 'Apache License 2.0', :file => 'LICENSE' }
s.author = { 'sameersyd' => '[email protected]' }
s.source = { :git => 'https://github.com/sameersyd/FortuneWheel.git', :tag => s.version.to_s }
s.social_media_url = 'https://www.linkedin.com/in/sameer-nawaz-linked/'
Expand Down
6 changes: 3 additions & 3 deletions Source/FortuneWheel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public struct FortuneWheel: View {
var colors: [Color] = Color.spin_wheel_color, pointerColor: Color = Color(hex: "DA4533")
@StateObject var viewModel: FortuneWheelViewModel

public init(titles: [String], size: CGFloat, onSpinEnd: ((Int) -> ())?, colors: [Color]? = nil, pointerColor: Color? = nil, strokeWidth: CGFloat = 15, strokeColor: Color? = nil, animDuration: Double = Double(6), timeCurveAnimation: Animation? = nil) {
public init(titles: [String], size: CGFloat, onSpinEnd: ((Int) -> ())?, colors: [Color]? = nil, pointerColor: Color? = nil, strokeWidth: CGFloat = 15, strokeColor: Color? = nil, animDuration: Double = Double(6), animation: Animation? = nil) {

self.titles = titles
self.size = size
Expand All @@ -24,8 +24,8 @@ public struct FortuneWheel: View {
if let pointerColor = pointerColor { self.pointerColor = pointerColor }
if let strokeColor = strokeColor { self.strokeColor = strokeColor }

let animation = Animation.timingCurve(0.51, 0.97, 0.56, 0.99, duration: animDuration)
_viewModel = StateObject(wrappedValue: FortuneWheelViewModel(titles: titles, animDuration: animDuration, timeCurveAnimation: timeCurveAnimation ?? animation, onSpinEnd: onSpinEnd))
let timeCurveAnimation = Animation.timingCurve(0.51, 0.97, 0.56, 0.99, duration: animDuration)
_viewModel = StateObject(wrappedValue: FortuneWheelViewModel(titles: titles, animDuration: animDuration, animation: animation ?? timeCurveAnimation, onSpinEnd: onSpinEnd))
}

public var body: some View {
Expand Down
8 changes: 4 additions & 4 deletions Source/FortuneWheelViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ class FortuneWheelViewModel: ObservableObject {

@Published var degree = 0.0
private let animDuration: Double
private var timeCurveAnimation: Animation
private var animation: Animation
private var pendingRequestWorkItem: DispatchWorkItem?

private var onSpinEnd: ((Int) -> ())?

init(titles: [String], animDuration: Double, timeCurveAnimation: Animation, onSpinEnd: ((Int) -> ())?) {
init(titles: [String], animDuration: Double, animation: Animation, onSpinEnd: ((Int) -> ())?) {
self.titles = titles
self.animDuration = animDuration
self.timeCurveAnimation = timeCurveAnimation
self.animation = animation
self.onSpinEnd = onSpinEnd
}

func spinWheel() {
let d = Double.random(in: 720...7200)
withAnimation(timeCurveAnimation) { self.degree += d }
withAnimation(animation) { self.degree += d }
// Cancel the currently pending item
pendingRequestWorkItem?.cancel()
// Wrap our request in a work item
Expand Down
2 changes: 1 addition & 1 deletion Source/SpinWheel/SpinWheelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct SpinWheelView: View {
ForEach(0..<data.count) { index in
SpinWheelCell(startAngle: startAngle(for: index), endAngle: endAngle(for: index))
.fill(colors[index % colors.count])
Text(labels[index]).foregroundColor(Color.white)
Text(labels[index]).foregroundColor(Color.white).fontWeight(.bold)
.offset(viewOffset(for: index, in: geo.size)).zIndex(1)
}
}
Expand Down

0 comments on commit 53625b5

Please sign in to comment.