Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	SwiftFortuneWheel.podspec
  • Loading branch information
sh-khashimov committed Nov 12, 2020
2 parents 6a695eb + 7cd965b commit dcef2a6
Show file tree
Hide file tree
Showing 238 changed files with 36,592 additions and 1,084 deletions.
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# references:
# * https://www.objc.io/issues/6-build-tools/travis-ci/
# * https://github.com/supermarin/xcpretty#usage

osx_image: xcode11.2
language: swift
xcode_project: SwiftFortuneWheel.xcodeproj # path to your xcodeproj folder
xcode_scheme: SwiftFortuneWheelTests
xcode_destination: platform=iOS Simulator,OS=13.2.2,name=iPhone 11

# cache: cocoapods
# podfile: Example/Podfile
# before_install:
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example

# script:
# - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/RESegmentedControl.xcworkspace -scheme RESegmentedControl-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty
# - pod lib lint
16 changes: 8 additions & 8 deletions Documentation/API_Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,33 @@ func rotate(rotationOffset: CGFloat, animationDuration: CFTimeInterval = 0.00001
</br>


- Starts indefinite rotation animation
- Starts continuos rotation animation
``` Swift
func startAnimating()
func startContinuousRotationAnimation()
```
- Stops all animations
``` Swift
func stopAnimating()
func stopRotation()
```


</br>

- Starts rotation animation and stops rotation at the specified index and rotation angle offset.
``` Swift
func startAnimating(finishIndex: Int, rotationOffset: CGFloat, _ completion: ((Bool) -> Void)?)
func startRotationAnimation(finishIndex: Int, rotationOffset: CGFloat, _ completion: ((Bool) -> Void)?)
```
- Starts rotation animation and stops rotation at the specified index.
``` Swift
func startAnimating(finishIndex: Int, _ completion: ((Bool) -> Void)?)
func startRotationAnimation(finishIndex: Int, _ completion: ((Bool) -> Void)?)
```
- Starts rotation animation and stops rotation at the specified rotation offset angle.
``` Swift
func startAnimating(rotationOffset: CGFloat, _ completion: ((Bool) -> Void)?)
func startRotationAnimation(rotationOffset: CGFloat, _ completion: ((Bool) -> Void)?)
```
- Starts indefinite rotation and stops rotation at the specified index.
- Starts continuos rotation and stops rotation at the specified index.
``` Swift
func startAnimating(indefiniteRotationTimeInSeconds: Int, finishIndex: Int, _ completion: ((Bool) -> Void)?)
func startRotationAnimation(finishIndex: Int, continuousRotationTime: Int, _ completion: ((Bool) -> Void)?)
```

---
Expand Down
7 changes: 7 additions & 0 deletions Documentation/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## CHANGELOG

### 1.2.0

- Added sound effect and haptic feedback during the rotation;
- [Issue #6](https://github.com/sh-khashimov/SwiftFortuneWheel/issues/6): animation callback added;
- Animation API refined;
- iOS Example project updated;

### 1.1.3

- `characterWrap` type added to the `TextPreferences.LineBreakMode`;
Expand Down
2 changes: 1 addition & 1 deletion Documentation/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fortuneWheel.slices = slices
- To start spin animation:

``` Swift
fortuneWheel.startAnimating(indefiniteRotationTimeInSeconds: 1, finishIndex: 0) { (finished) in
fortuneWheel.startRotationAnimation(finishIndex: 0, continuousRotationTime: 1) { (finished) in
print(finished)
}
```
Expand Down
12 changes: 12 additions & 0 deletions Documentation/Migrations/Migration_1.1.x_to_1.2.x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Migration

### from 1.1.x to 1.2.x

- Fix the warning messages

Animation API was changed:

- `startAnimating` was renamed to `startRotationAnimation`;
- `stopAnimating` was renamed to `stopRotation`;
- `startAnimating(rotationTime: CFTimeInterval = 5.000, fullRotationCountInRotationTime: CGFloat = 7000)` was deprecated, use `startContinuousRotationAnimation(with: speed)` instead;
- `startAnimating(indefiniteRotationTimeInSeconds: Int, finishIndex: Int, _ completion: ((Bool) -> Void)?)` was deprecated, use `startRotationAnimation(finishIndex:continuousRotationTime:completion:)` instead;
74 changes: 74 additions & 0 deletions Documentation/sound_effects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
## Sound Effects and Impact Feedback

**`SwiftFortuneWheel`** can play sounds when the edge or the center of a slice moves during the rotation. Optionally, it’s possible to turn on the haptic feedback while playing sound. Or use the impact callback and implement your own effect.


### Edge Collision Sound Effect Example

``` Swift
@IBOutlet weak var fortuneWheel: SwiftFortuneWheel!
// after SwiftFortuneWheel init and configuration…

// add Click.mp3 to your project, create AudioFile, and set to edgeCollisionSound
fortuneWheel.edgeCollisionSound = AudioFile(filename: "Click", extensionName: "mp3")

// optionally, turn on the haptic feedback for each impact
fortuneWheel.impactFeedbackOn = true

// turn on the edge collision detection
fortuneWheel.edgeCollisionDetectionOn = true

```

### Example to use callback for Edge Collision

``` Swift
@IBOutlet weak var fortuneWheel: SwiftFortuneWheel!
// after SwiftFortuneWheel init and configuration…

// edge collision callback with progress, if rotation is continuous, progress is equal to nil
fortuneWheel.onEdgeCollision = { progress in
print("edge collision progress: \(String(describing: progress))")
}

// turn on the center collision detection
fortuneWheel.edgeCollisionDetectionOn = true

```

### Center Collision Sound Effect Example

``` Swift
@IBOutlet weak var fortuneWheel: SwiftFortuneWheel!
// after SwiftFortuneWheel init and configuration…

// add Click.mp3 to your project, create AudioFile, and set to centerCollisionSound
fortuneWheel.centerCollisionSound = AudioFile(filename: "Click", extensionName: "mp3")

// optionally, turn on the haptic feedback for each impact
fortuneWheel.impactFeedbackOn = true

// turn on the center collision detection
fortuneWheel.centerCollisionDetectionOn = true

```

### Example to use callback for Center Collision

``` Swift
@IBOutlet weak var fortuneWheel: SwiftFortuneWheel!
// after SwiftFortuneWheel init and configuration…

// center collision callback with progress, if rotation is continuous, progress is equal to nil
fortuneWheel.onCenterCollision = { progress in
print("center collision progress: \(String(describing: progress))")
}

// turn on the center collision detection
fortuneWheel.centerCollisionDetectionOn = true

```

> _**`impactFeedbackOn`** is only available on iOS 10 and above, not available on other platforms_
> **For more information, see [example projects](../Examples)**
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@
2710568F248D541B006C0181 /* Prize+SliceContentType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2710568E248D541B006C0181 /* Prize+SliceContentType.swift */; };
276E7FFF24B378E5004E9D82 /* AnimatedRotationExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 276E7FFE24B378E5004E9D82 /* AnimatedRotationExampleViewController.swift */; };
276E800224B37954004E9D82 /* LayoutExamplesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 276E800124B37954004E9D82 /* LayoutExamplesViewController.swift */; };
276E95C5255CF9CD0018D843 /* Tick.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 276E95C4255CF9CD0018D843 /* Tick.mp3 */; };
2794D29C24B3977B00379B6A /* SFWConfiguration+RotationExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2794D29B24B3977B00379B6A /* SFWConfiguration+RotationExample.swift */; };
279BA971255AAF470088BFCF /* BackgroundImageExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279BA970255AAF470088BFCF /* BackgroundImageExampleViewController.swift */; };
279BA974255AAF6B0088BFCF /* SoundExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279BA973255AAF6B0088BFCF /* SoundExampleViewController.swift */; };
279BA9B6255BA8F40088BFCF /* SFWConfiguration+BackgroundImageExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279BA9B5255BA8F40088BFCF /* SFWConfiguration+BackgroundImageExample.swift */; };
279BA9E4255BB1FD0088BFCF /* SFWConfiguration+SoundExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279BA9E3255BB1FD0088BFCF /* SFWConfiguration+SoundExample.swift */; };
279EEF8624B39D8000AD2AB2 /* RotationExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279EEF8524B39D8000AD2AB2 /* RotationExampleViewController.swift */; };
279EEF8824B39F5700AD2AB2 /* Various.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 279EEF8724B39F5700AD2AB2 /* Various.storyboard */; };
279EEF9424B5C31C00AD2AB2 /* VariousWheelSpikeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279EEF9324B5C31B00AD2AB2 /* VariousWheelSpikeViewController.swift */; };
27C6486E24BE1A6D00CB8167 /* SplitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27C6486D24BE1A6D00CB8167 /* SplitViewController.swift */; };
27DA036A254ED51B0019A7F1 /* Click.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 27DA0369254ED51B0019A7F1 /* Click.mp3 */; };
27E8C95724B8CF480021205F /* VariousWheelSimpleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E8C95624B8CF480021205F /* VariousWheelSimpleViewController.swift */; };
27E8C95924B8CF690021205F /* SFWConfiguration+VariousWheelSimple.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E8C95824B8CF690021205F /* SFWConfiguration+VariousWheelSimple.swift */; };
27E8C95B24B8D2D20021205F /* Color+Hex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E8C95A24B8D2D20021205F /* Color+Hex.swift */; };
Expand Down Expand Up @@ -74,11 +80,17 @@
274E9E3524BBA05E00613A49 /* SwiftFortuneWheelDemo-iOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "SwiftFortuneWheelDemo-iOS.entitlements"; sourceTree = "<group>"; };
276E7FFE24B378E5004E9D82 /* AnimatedRotationExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimatedRotationExampleViewController.swift; sourceTree = "<group>"; };
276E800124B37954004E9D82 /* LayoutExamplesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutExamplesViewController.swift; sourceTree = "<group>"; };
276E95C4255CF9CD0018D843 /* Tick.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; name = Tick.mp3; path = "../../SwiftFortuneWheelDemo-tvOS/SwiftFortuneWheelDemo-tvOS/SwiftFortuneWheelDemo-tvOS/Tick.mp3"; sourceTree = "<group>"; };
2794D29B24B3977B00379B6A /* SFWConfiguration+RotationExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SFWConfiguration+RotationExample.swift"; sourceTree = "<group>"; };
279BA970255AAF470088BFCF /* BackgroundImageExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundImageExampleViewController.swift; sourceTree = "<group>"; };
279BA973255AAF6B0088BFCF /* SoundExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoundExampleViewController.swift; sourceTree = "<group>"; };
279BA9B5255BA8F40088BFCF /* SFWConfiguration+BackgroundImageExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SFWConfiguration+BackgroundImageExample.swift"; sourceTree = "<group>"; };
279BA9E3255BB1FD0088BFCF /* SFWConfiguration+SoundExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SFWConfiguration+SoundExample.swift"; sourceTree = "<group>"; };
279EEF8524B39D8000AD2AB2 /* RotationExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RotationExampleViewController.swift; sourceTree = "<group>"; };
279EEF8724B39F5700AD2AB2 /* Various.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Various.storyboard; sourceTree = "<group>"; };
279EEF9324B5C31B00AD2AB2 /* VariousWheelSpikeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VariousWheelSpikeViewController.swift; sourceTree = "<group>"; };
27C6486D24BE1A6D00CB8167 /* SplitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplitViewController.swift; sourceTree = "<group>"; };
27DA0369254ED51B0019A7F1 /* Click.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = Click.mp3; sourceTree = "<group>"; };
27E8C95624B8CF480021205F /* VariousWheelSimpleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VariousWheelSimpleViewController.swift; sourceTree = "<group>"; };
27E8C95824B8CF690021205F /* SFWConfiguration+VariousWheelSimple.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SFWConfiguration+VariousWheelSimple.swift"; sourceTree = "<group>"; };
27E8C95A24B8D2D20021205F /* Color+Hex.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Hex.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -155,6 +167,8 @@
27E8C96A24B9B42D0021205F /* ToyBox.ttf */,
274E9E3324BB9F5100613A49 /* Info.plist */,
27E8C96824B9B3250021205F /* Ode to Idle Gaming.otf */,
276E95C4255CF9CD0018D843 /* Tick.mp3 */,
27DA0369254ED51B0019A7F1 /* Click.mp3 */,
27105636248D3C9F006C0181 /* Assets.xcassets */,
27105638248D3C9F006C0181 /* LaunchScreen.storyboard */,
);
Expand All @@ -169,13 +183,13 @@
name = Frameworks;
sourceTree = "<group>";
};
2720251E24A36F6300240E4E /* DynamicContentExampleViewController */ = {
2720251E24A36F6300240E4E /* DynamicContentExample */ = {
isa = PBXGroup;
children = (
27105688248D4EC8006C0181 /* DynamicContentViewExampleController.swift */,
2710568A248D53EF006C0181 /* SFWConfiguration+DynamicContentExample.swift */,
);
path = DynamicContentExampleViewController;
path = DynamicContentExample;
sourceTree = "<group>";
};
276E7FFD24B378A0004E9D82 /* RotationExample */ = {
Expand Down Expand Up @@ -208,7 +222,9 @@
2780E81124B36E3F007BDE7B /* ViewControllers */ = {
isa = PBXGroup;
children = (
2720251E24A36F6300240E4E /* DynamicContentExampleViewController */,
279BA972255AAF520088BFCF /* SoundExample */,
279BA96F255AAF070088BFCF /* BackgroundImageExample */,
2720251E24A36F6300240E4E /* DynamicContentExample */,
276E7FFD24B378A0004E9D82 /* RotationExample */,
2794D29D24B39BDD00379B6A /* AnimatedRotationExample */,
270CCFDB24B3759100924FBF /* WithoutStoryboardExample */,
Expand All @@ -228,6 +244,24 @@
path = AnimatedRotationExample;
sourceTree = "<group>";
};
279BA96F255AAF070088BFCF /* BackgroundImageExample */ = {
isa = PBXGroup;
children = (
279BA970255AAF470088BFCF /* BackgroundImageExampleViewController.swift */,
279BA9B5255BA8F40088BFCF /* SFWConfiguration+BackgroundImageExample.swift */,
);
path = BackgroundImageExample;
sourceTree = "<group>";
};
279BA972255AAF520088BFCF /* SoundExample */ = {
isa = PBXGroup;
children = (
279BA973255AAF6B0088BFCF /* SoundExampleViewController.swift */,
279BA9E3255BB1FD0088BFCF /* SFWConfiguration+SoundExample.swift */,
);
path = SoundExample;
sourceTree = "<group>";
};
279EEF8924B39F7C00AD2AB2 /* Various */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -334,6 +368,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
27DA036A254ED51B0019A7F1 /* Click.mp3 in Resources */,
276E95C5255CF9CD0018D843 /* Tick.mp3 in Resources */,
2710563A248D3C9F006C0181 /* LaunchScreen.storyboard in Resources */,
27E8C96B24B9B42D0021205F /* ToyBox.ttf in Resources */,
27105637248D3C9F006C0181 /* Assets.xcassets in Resources */,
Expand All @@ -352,16 +388,20 @@
files = (
27E8C95E24B8D8560021205F /* VariousWheelJackpotViewController.swift in Sources */,
27FA0A1B24B5C3D800CA1F02 /* SFWConfiguration+VariousWheelSpike.swift in Sources */,
279BA9B6255BA8F40088BFCF /* SFWConfiguration+BackgroundImageExample.swift in Sources */,
2710568D248D53EF006C0181 /* Prize.swift in Sources */,
27E8C96524B8E1590021205F /* SFWConfiguration+VariousWheelPodium.swift in Sources */,
2703B4F6248E2A9500FB50F9 /* UIView+CornerRadius.swift in Sources */,
279BA971255AAF470088BFCF /* BackgroundImageExampleViewController.swift in Sources */,
27F7D5B924A51C5D004BEE19 /* WithoutStoryboardExampleViewController.swift in Sources */,
2710568F248D541B006C0181 /* Prize+SliceContentType.swift in Sources */,
27E8C95B24B8D2D20021205F /* Color+Hex.swift in Sources */,
279EEF8624B39D8000AD2AB2 /* RotationExampleViewController.swift in Sources */,
279BA9E4255BB1FD0088BFCF /* SFWConfiguration+SoundExample.swift in Sources */,
27FA0A1D24B5CA1F00CA1F02 /* LayoutCollectionViewCell.swift in Sources */,
27C6486E24BE1A6D00CB8167 /* SplitViewController.swift in Sources */,
27E8C95924B8CF690021205F /* SFWConfiguration+VariousWheelSimple.swift in Sources */,
279BA974255AAF6B0088BFCF /* SoundExampleViewController.swift in Sources */,
27E8C96024B8D87E0021205F /* SFWConfiguration+VariousWheelJackpot.swift in Sources */,
27105687248D4E49006C0181 /* MainViewController.swift in Sources */,
276E800224B37954004E9D82 /* LayoutExamplesViewController.swift in Sources */,
Expand Down Expand Up @@ -451,7 +491,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.5;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -506,7 +546,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.5;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand All @@ -524,7 +564,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = M626AUYJ9J;
INFOPLIST_FILE = "$(SRCROOT)/SwiftFortuneWheelDemo-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.1;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -545,7 +585,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = M626AUYJ9J;
INFOPLIST_FILE = "$(SRCROOT)/SwiftFortuneWheelDemo-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.1;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Colorful-Plait-Background.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Geometric-Background-Colorful-Vector.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit dcef2a6

Please sign in to comment.