Skip to content

Commit

Permalink
release 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-khashimov committed Jun 25, 2020
1 parent c240a1f commit f4d6203
Show file tree
Hide file tree
Showing 13 changed files with 295 additions and 106 deletions.
6 changes: 6 additions & 0 deletions Documentation/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## CHANGELOG

### 0.7.0
- added text orientation to `TextPreferences`;
- `preferedFontSize` removed from `TextPreferences`;
- `flipUpsideDown` fixed;


### v0.6.2
- fixed bug during init process;
- in `TextPreferences`, `flipUpsideDown` now default value is `true`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
2710568D248D53EF006C0181 /* Prize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2710568B248D53EF006C0181 /* Prize.swift */; };
2710568F248D541B006C0181 /* Prize+SliceContentType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2710568E248D541B006C0181 /* Prize+SliceContentType.swift */; };
2720252124A36FB700240E4E /* SwiftFortuneWheelConfiguration+RainbowColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2720252024A36FB700240E4E /* SwiftFortuneWheelConfiguration+RainbowColors.swift */; };
27F7D5B924A51C5D004BEE19 /* Example2ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27F7D5B824A51C5D004BEE19 /* Example2ViewController.swift */; };
27F7D5BB24A51D01004BEE19 /* SwiftFortuneWheelConfiguration+Example2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27F7D5BA24A51D01004BEE19 /* SwiftFortuneWheelConfiguration+Example2.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -53,6 +55,8 @@
2710568B248D53EF006C0181 /* Prize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Prize.swift; sourceTree = "<group>"; };
2710568E248D541B006C0181 /* Prize+SliceContentType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Prize+SliceContentType.swift"; sourceTree = "<group>"; };
2720252024A36FB700240E4E /* SwiftFortuneWheelConfiguration+RainbowColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SwiftFortuneWheelConfiguration+RainbowColors.swift"; sourceTree = "<group>"; };
27F7D5B824A51C5D004BEE19 /* Example2ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Example2ViewController.swift; sourceTree = "<group>"; };
27F7D5BA24A51D01004BEE19 /* SwiftFortuneWheelConfiguration+Example2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SwiftFortuneWheelConfiguration+Example2.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -124,6 +128,8 @@
2720251F24A36F8900240E4E /* Example2ViewController */ = {
isa = PBXGroup;
children = (
27F7D5B824A51C5D004BEE19 /* Example2ViewController.swift */,
27F7D5BA24A51D01004BEE19 /* SwiftFortuneWheelConfiguration+Example2.swift */,
);
path = Example2ViewController;
sourceTree = "<group>";
Expand Down Expand Up @@ -202,8 +208,10 @@
files = (
2710568D248D53EF006C0181 /* Prize.swift in Sources */,
2703B4F6248E2A9500FB50F9 /* UIView+CornerRadius.swift in Sources */,
27F7D5B924A51C5D004BEE19 /* Example2ViewController.swift in Sources */,
2710568F248D541B006C0181 /* Prize+SliceContentType.swift in Sources */,
27105687248D4E49006C0181 /* ExamplesViewController.swift in Sources */,
27F7D5BB24A51D01004BEE19 /* SwiftFortuneWheelConfiguration+Example2.swift in Sources */,
2710562E248D3C9D006C0181 /* AppDelegate.swift in Sources */,
27105630248D3C9D006C0181 /* SceneDelegate.swift in Sources */,
2720252124A36FB700240E4E /* SwiftFortuneWheelConfiguration+RainbowColors.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,31 @@
<segue destination="uOf-zF-lNR" kind="show" id="n7U-nY-Ona"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" id="cXc-rf-PCr">
<rect key="frame" x="0.0" y="71.5" width="414" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="cXc-rf-PCr" id="mae-of-eYx">
<rect key="frame" x="0.0" y="0.0" width="383" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Example2" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cTi-MZ-oBb">
<rect key="frame" x="15" y="0.0" width="353" height="50"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="cTi-MZ-oBb" secondAttribute="trailing" constant="15" id="4Iv-gx-gLi"/>
<constraint firstItem="cTi-MZ-oBb" firstAttribute="leading" secondItem="mae-of-eYx" secondAttribute="leading" constant="15" id="8BD-Gv-6Py"/>
<constraint firstItem="cTi-MZ-oBb" firstAttribute="top" secondItem="mae-of-eYx" secondAttribute="top" id="Uvg-h3-Ynt"/>
<constraint firstAttribute="bottom" secondItem="cTi-MZ-oBb" secondAttribute="bottom" id="Xj7-a5-78I"/>
</constraints>
</tableViewCellContentView>
<connections>
<segue destination="JsW-zt-FSX" kind="show" id="eC5-px-ySG"/>
</connections>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
Expand Down Expand Up @@ -267,6 +292,22 @@
</objects>
<point key="canvasLocation" x="1097.1014492753625" y="137.94642857142856"/>
</scene>
<!--Example2 View Controller-->
<scene sceneID="qda-aq-Ly8">
<objects>
<viewController storyboardIdentifier="Example2ViewController" id="JsW-zt-FSX" customClass="Example2ViewController" customModule="SwiftFortuneWheelDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="VNL-N5-dnK">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="D14-MA-7SS"/>
</view>
<navigationItem key="navigationItem" id="Xjr-rD-pIf"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="XPr-om-LL9" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1097" y="867"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="AVk-El-Bh6">
<objects>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// Example2ViewController.swift
// SwiftFortuneWheelDemoiOS
//
// Created by Sherzod Khashimov on 6/25/20.
// Copyright © 2020 Sherzod Khashimov. All rights reserved.
//

import UIKit
import SwiftFortuneWheel

class Example2ViewController: UIViewController {

lazy var fortuneWheel: SwiftFortuneWheel = {
var slices: [Slice] = []

for index in 1...4 {
let headerContent = Slice.ContentType.text(text: "\(index)", preferenes: .example2AmountTextPreferences)
let descriptionContent = Slice.ContentType.text(text: "DESCRIPTION", preferenes: .example2DescriptionTextPreferences)
let slice = Slice(contents: [headerContent, descriptionContent])
slices.append(slice)
}

let frame = CGRect(x: 35, y: 100, width: 300, height: 300)

let fortuneWheel = SwiftFortuneWheel(frame: frame, slices: slices, configuration: .example2Configuration)

fortuneWheel.isPinHidden = true
fortuneWheel.isSpinHidden = true
return fortuneWheel
}()

override func viewDidLoad() {
super.viewDidLoad()

self.title = "Example2"

view.addSubview(fortuneWheel)
layoutWheel()

}

func layoutWheel() {
guard let superview = fortuneWheel.superview else { return }
fortuneWheel.translatesAutoresizingMaskIntoConstraints = false
fortuneWheel.widthAnchor.constraint(equalToConstant: 300).isActive = true
fortuneWheel.heightAnchor.constraint(equalToConstant: 300).isActive = true
fortuneWheel.centerYAnchor.constraint(equalTo: superview.centerYAnchor).isActive = true
fortuneWheel.centerXAnchor.constraint(equalTo: superview.centerXAnchor).isActive = true
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
//
// SwiftFortuneWheelConfiguration+Example2.swift
// SwiftFortuneWheelDemoiOS
//
// Created by Sherzod Khashimov on 6/25/20.
// Copyright © 2020 Sherzod Khashimov. All rights reserved.
//

import Foundation
import UIKit
import SwiftFortuneWheel

private let circleStrokeWidth: CGFloat = 2
private let blackColor = UIColor(white: 51.0 / 255.0, alpha: 1.0)
private let redColor = UIColor.red

public extension SwiftFortuneWheelConfiguration {
static var example2Configuration: SwiftFortuneWheelConfiguration {
let configuration = SwiftFortuneWheelConfiguration(spinButtonPreferences: .example2SpinButtonPreferences,
pinPreferences: .example2PinPreferences,
wheelPreferences: .example2WheelPreferences)

return configuration
}
}

public extension SwiftFortuneWheelConfiguration.SpinButtonPreferences {
static var example2SpinButtonPreferences: SwiftFortuneWheelConfiguration.SpinButtonPreferences {
let preferences = SwiftFortuneWheelConfiguration.SpinButtonPreferences(size: CGSize(width: 80, height: 80),
cornerRadius: 40,
textColor: .white,
font: .systemFont(ofSize: 20, weight: .bold),
backgroundColor: blackColor)
return preferences
}
}

public extension SwiftFortuneWheelConfiguration.PinImageViewPreferences {
static var example2PinPreferences: SwiftFortuneWheelConfiguration.PinImageViewPreferences {
let preferences = SwiftFortuneWheelConfiguration.PinImageViewPreferences(size: CGSize(width: 12, height: 24),
position: .top,
verticalOffset: 30)
return preferences
}
}

public extension SwiftFortuneWheelConfiguration.WheelPreferences {
static var example2WheelPreferences: SwiftFortuneWheelConfiguration.WheelPreferences {
let preferences = SwiftFortuneWheelConfiguration.WheelPreferences(circlePreferences: .example2CirclePreferences,
slicePreferences: .example2SlicePreferenes)
return preferences
}
}

public extension SwiftFortuneWheelConfiguration.CirclePreferences {
static var example2CirclePreferences: SwiftFortuneWheelConfiguration.CirclePreferences {
let preferences = SwiftFortuneWheelConfiguration.CirclePreferences(strokeWidth: circleStrokeWidth,
strokeColor: blackColor)
return preferences
}
}

public extension SwiftFortuneWheelConfiguration.SlicePreferences {
static var example2SlicePreferenes: SwiftFortuneWheelConfiguration.SlicePreferences {
let backgroundColorType = SwiftFortuneWheelConfiguration.ColorType.evenOddColors(evenColor: blackColor, oddColor: redColor)
let preferences = SwiftFortuneWheelConfiguration.SlicePreferences(backgroundColorType: backgroundColorType,
strokeWidth: 1,
strokeColor: blackColor)
return preferences
}
}

public extension TextPreferences {
static var example2AmountTextPreferences: TextPreferences {
let textColorType = SwiftFortuneWheelConfiguration.ColorType.customPatternColors(colors: nil, defaultColor: .white)
let font = UIFont.systemFont(ofSize: 22, weight: .bold)
let prefenreces = TextPreferences(textColorType: textColorType,
font: font,
verticalOffset: 10,
isCurved: true)
return prefenreces
}

static var example2DescriptionTextPreferences: TextPreferences {
let textColorType = SwiftFortuneWheelConfiguration.ColorType.customPatternColors(colors: nil, defaultColor: .white)
let font = UIFont.systemFont(ofSize: 12, weight: .bold)
let prefenreces = TextPreferences(textColorType: textColorType,
font: font,
verticalOffset: 10,
orientation: .vertical,
flipUpsideDown: false,
isCurved: false)
return prefenreces
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ extension TextPreferences {
let font = UIFont.systemFont(ofSize: 20, weight: .bold)
let prefenreces = TextPreferences(textColorType: textColorType,
font: font,
preferedFontSize: 20,
verticalOffset: 25,
flipUpsideDown: true,
isCurved: true)
Expand All @@ -103,7 +102,6 @@ extension TextPreferences {
let font = UIFont.systemFont(ofSize: 10, weight: .bold)
let prefenreces = TextPreferences(textColorType: textColorType,
font: font,
preferedFontSize: 10,
verticalOffset: 10,
orientation: .horizontal,
flipUpsideDown: true,
Expand All @@ -117,7 +115,6 @@ extension TextPreferences {
let font = UIFont.systemFont(ofSize: 20, weight: .bold)
let prefenreces = TextPreferences(textColorType: textColorType,
font: font,
preferedFontSize: 20,
verticalOffset: 25,
flipUpsideDown: true,
isCurved: true)
Expand All @@ -129,7 +126,6 @@ extension TextPreferences {
let font = UIFont.systemFont(ofSize: 10, weight: .bold)
let prefenreces = TextPreferences(textColorType: textColorType,
font: font,
preferedFontSize: 10,
verticalOffset: 10,
orientation: .horizontal,
flipUpsideDown: true,
Expand Down
2 changes: 1 addition & 1 deletion Playgrounds/MyPlayground.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MyViewController : UIViewController {

for index in 1...4 {
let headerContent = Slice.ContentType.text(text: "\(index)", preferenes: .amountTextPreferences)
let descriptionContent = Slice.ContentType.text(text: "Description", preferenes: .descriptionTextPreferences)
let descriptionContent = Slice.ContentType.text(text: "DESCRIPTION", preferenes: .descriptionTextPreferences)
let slice = Slice(contents: [headerContent, descriptionContent])
slices.append(slice)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ public extension TextPreferences {
let font = UIFont.systemFont(ofSize: 22, weight: .bold)
let prefenreces = TextPreferences(textColorType: textColorType,
font: font,
preferedFontSize: 20,
verticalOffset: 10,
flipUpsideDown: true,
isCurved: true)
return prefenreces
}
Expand All @@ -90,10 +88,9 @@ public extension TextPreferences {
let font = UIFont.systemFont(ofSize: 12, weight: .bold)
let prefenreces = TextPreferences(textColorType: textColorType,
font: font,
preferedFontSize: 10,
verticalOffset: 3,
flipUpsideDown: true,
isCurved: true)
verticalOffset: 10,
orientation: .vertical,
isCurved: false)
return prefenreces
}
}
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@

Fortune spinning wheel that supports dynamic content and rich customization.

<img src="./Images/layout.gif" width="320"/>

| | Main Features |
|---|---|
| 🏵 | Dynamic content, support image, and text |
| 🏵 | Dynamic content, supports texts, images, and lines |
| 🎛 | Supports vertical and horizontal text orientation |
| 🌈 | Appearance customization |
| 🎨 | Drawn and animated using CoreGraphics |
| 🧮 | Dynamic layout |
| 🚀 | Written in Swift |

## Preview

<img src="./Images/layout.gif" width="320"/>
<img src="./Images/rotation.gif" width="320"/>

## Getting Started
- [**Getting started guide**](/Documentation/GettingStarted.md)

Expand All @@ -33,7 +37,7 @@ You can find <a href="https://sh-khashimov.github.io/SwiftFortuneWheel/" target=
## Requirements


| App version | Swift | Xcode | Platforms |
| App name | Swif | Xcode | Platforms |
|---|---|---|---|
| current version | Swift 5.0 | Xcode 11 | iOS 9.0 |

Expand All @@ -51,9 +55,5 @@ Please make sure to update tests as appropriate.

Sherzod Khashimov

## Changelog

See [**changelog here**](/Documentation/Changelog.md)

## License
[MIT](https://choosealicense.com/licenses/mit/)
Loading

0 comments on commit f4d6203

Please sign in to comment.