├── README.md ├── RouletteWheel ├── AppDelegate │ └── AppDelegate.swift ├── Assets.xcassets │ ├── 1st 12.imageset │ │ ├── 1st 12.png │ │ ├── 1st 12@2x.png │ │ ├── 1st 12@3x.png │ │ └── Contents.json │ ├── 2nd 12.imageset │ │ ├── 2nd 12.png │ │ ├── 2nd 12@2x.png │ │ ├── 2nd 12@3x.png │ │ └── Contents.json │ ├── 3rd 12.imageset │ │ ├── 3rd 12.png │ │ ├── 3rd 12@2x.png │ │ ├── 3rd 12@3x.png │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── EVEN.imageset │ │ ├── Contents.json │ │ ├── EVEN.png │ │ ├── EVEN@2x.png │ │ └── EVEN@3x.png │ ├── ODD.imageset │ │ ├── Contents.json │ │ ├── ODD.png │ │ ├── ODD@2x.png │ │ └── ODD@3x.png │ ├── Rectangle_black.imageset │ │ ├── Contents.json │ │ ├── Rectangle_black.png │ │ ├── Rectangle_black@2x.png │ │ └── Rectangle_black@3x.png │ ├── Triangle_blue-1.imageset │ │ ├── Contents.json │ │ ├── Triangle_blue.png │ │ ├── Triangle_blue@2x.png │ │ └── Triangle_blue@3x.png │ ├── Triangle_blue.imageset │ │ ├── Contents.json │ │ ├── Triangle_blue.png │ │ ├── Triangle_blue@2x.png │ │ └── Triangle_blue@3x.png │ ├── Wheel_without_number.imageset │ │ ├── Contents.json │ │ ├── Wheel_without_number.png │ │ ├── Wheel_without_number@2x.png │ │ └── Wheel_without_number@3x.png │ ├── ball.imageset │ │ ├── Contents.json │ │ ├── ball.png │ │ ├── ball@2x.png │ │ └── ball@3x.png │ ├── inner wheel.imageset │ │ ├── Contents.json │ │ ├── inner wheel.png │ │ ├── inner wheel@2x.png │ │ └── inner wheel@3x.png │ ├── outer_wheel.imageset │ │ ├── Contents.json │ │ ├── outer_wheel.png │ │ ├── outer_wheel@2x.png │ │ └── outer_wheel@3x.png │ ├── rectangle_red.imageset │ │ ├── Contents.json │ │ ├── rectangle_red.png │ │ ├── rectangle_red@2x.png │ │ └── rectangle_red@3x.png │ ├── red_half.imageset │ │ ├── Contents.json │ │ ├── red_half.png │ │ ├── red_half@2x.png │ │ └── red_half@3x.png │ ├── wheel.imageset │ │ ├── Contents.json │ │ ├── wheel.png │ │ ├── wheel@2x.png │ │ └── wheel@3x.png │ ├── wooden_background.imageset │ │ ├── Amazing-Wooden-Background-For-You.png │ │ ├── Amazing-Wooden-Background-For-You@2x.png │ │ ├── Amazing-Wooden-Background-For-You@3x.png │ │ └── Contents.json │ └── yellow_half.imageset │ │ ├── Contents.json │ │ ├── yellow_half.png │ │ ├── yellow_half@2x.png │ │ └── yellow_half@3x.png ├── Info.plist ├── Libraries │ ├── ButtonPiece.swift │ ├── ButtonViewBuilder.swift │ ├── ButtonWheel.swift │ ├── Enums.swift │ ├── PDFloraButton.swift │ ├── TouchManagement.swift │ ├── UsefulExtensions.swift │ └── VectorHelp.swift ├── StoryBoard │ ├── LaunchScreen.storyboard │ └── Main.storyboard └── WheelControllers │ ├── CreateWheel.swift │ └── WheelVC.swift ├── RouletteWheelGame.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ └── shubhamdhingra.xcuserdatad │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ ├── osx.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ └── xcschememanagement.plist │ └── shubhamdhingra.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── RouletteWheelTests ├── Info.plist └── RouletteWheelTests.swift └── RouletteWheelUITests ├── Info.plist └── RouletteWheelUITests.swift /README.md: -------------------------------------------------------------------------------- 1 | # Roulette Wheel 2 | Its is a roulette wheel that I have design in which user can enter a number and start rotating a roulette wheel and ball is stop in the roulette wheel correspond to that position in a wheel. 3 |
4 | 5 | 6 | -------------------------------------------------------------------------------- /RouletteWheel/AppDelegate/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // RouletteWheel 4 | // 5 | // Created by OSX on 18/12/17. 6 | // Copyright © 2017 OSX. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/1st 12.imageset/1st 12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/1st 12.imageset/1st 12.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/1st 12.imageset/1st 12@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/1st 12.imageset/1st 12@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/1st 12.imageset/1st 12@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/1st 12.imageset/1st 12@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/1st 12.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "1st 12.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "1st 12@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "1st 12@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/2nd 12.imageset/2nd 12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/2nd 12.imageset/2nd 12.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/2nd 12.imageset/2nd 12@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/2nd 12.imageset/2nd 12@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/2nd 12.imageset/2nd 12@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/2nd 12.imageset/2nd 12@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/2nd 12.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "2nd 12.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "2nd 12@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "2nd 12@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/3rd 12.imageset/3rd 12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/3rd 12.imageset/3rd 12.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/3rd 12.imageset/3rd 12@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/3rd 12.imageset/3rd 12@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/3rd 12.imageset/3rd 12@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/3rd 12.imageset/3rd 12@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/3rd 12.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "3rd 12.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "3rd 12@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "3rd 12@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/EVEN.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "EVEN.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "EVEN@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "EVEN@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/EVEN.imageset/EVEN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/EVEN.imageset/EVEN.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/EVEN.imageset/EVEN@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/EVEN.imageset/EVEN@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/EVEN.imageset/EVEN@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/EVEN.imageset/EVEN@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/ODD.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ODD.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "ODD@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "ODD@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/ODD.imageset/ODD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/ODD.imageset/ODD.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/ODD.imageset/ODD@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/ODD.imageset/ODD@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/ODD.imageset/ODD@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/ODD.imageset/ODD@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Rectangle_black.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Rectangle_black.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "Rectangle_black@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "Rectangle_black@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Rectangle_black.imageset/Rectangle_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Rectangle_black.imageset/Rectangle_black.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Rectangle_black.imageset/Rectangle_black@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Rectangle_black.imageset/Rectangle_black@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Rectangle_black.imageset/Rectangle_black@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Rectangle_black.imageset/Rectangle_black@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Triangle_blue-1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Triangle_blue.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "Triangle_blue@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "Triangle_blue@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Triangle_blue-1.imageset/Triangle_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Triangle_blue-1.imageset/Triangle_blue.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Triangle_blue-1.imageset/Triangle_blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Triangle_blue-1.imageset/Triangle_blue@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Triangle_blue-1.imageset/Triangle_blue@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Triangle_blue-1.imageset/Triangle_blue@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Triangle_blue.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Triangle_blue.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "Triangle_blue@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "Triangle_blue@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Triangle_blue.imageset/Triangle_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Triangle_blue.imageset/Triangle_blue.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Triangle_blue.imageset/Triangle_blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Triangle_blue.imageset/Triangle_blue@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Triangle_blue.imageset/Triangle_blue@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Triangle_blue.imageset/Triangle_blue@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Wheel_without_number.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Wheel_without_number.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "Wheel_without_number@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "Wheel_without_number@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Wheel_without_number.imageset/Wheel_without_number.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Wheel_without_number.imageset/Wheel_without_number.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Wheel_without_number.imageset/Wheel_without_number@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Wheel_without_number.imageset/Wheel_without_number@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/Wheel_without_number.imageset/Wheel_without_number@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/Wheel_without_number.imageset/Wheel_without_number@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/ball.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ball.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "ball@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "ball@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/ball.imageset/ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/ball.imageset/ball.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/ball.imageset/ball@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/ball.imageset/ball@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/ball.imageset/ball@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/ball.imageset/ball@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/inner wheel.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "inner wheel.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "inner wheel@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "inner wheel@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/inner wheel.imageset/inner wheel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/inner wheel.imageset/inner wheel.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/inner wheel.imageset/inner wheel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/inner wheel.imageset/inner wheel@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/inner wheel.imageset/inner wheel@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/inner wheel.imageset/inner wheel@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/outer_wheel.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "outer_wheel.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "outer_wheel@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "outer_wheel@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/outer_wheel.imageset/outer_wheel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/outer_wheel.imageset/outer_wheel.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/outer_wheel.imageset/outer_wheel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/outer_wheel.imageset/outer_wheel@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/outer_wheel.imageset/outer_wheel@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/outer_wheel.imageset/outer_wheel@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/rectangle_red.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "rectangle_red.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "rectangle_red@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "rectangle_red@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/rectangle_red.imageset/rectangle_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/rectangle_red.imageset/rectangle_red.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/rectangle_red.imageset/rectangle_red@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/rectangle_red.imageset/rectangle_red@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/rectangle_red.imageset/rectangle_red@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/rectangle_red.imageset/rectangle_red@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/red_half.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "red_half.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "red_half@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "red_half@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/red_half.imageset/red_half.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/red_half.imageset/red_half.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/red_half.imageset/red_half@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/red_half.imageset/red_half@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/red_half.imageset/red_half@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/red_half.imageset/red_half@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/wheel.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "wheel.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "wheel@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "wheel@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/wheel.imageset/wheel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/wheel.imageset/wheel.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/wheel.imageset/wheel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/wheel.imageset/wheel@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/wheel.imageset/wheel@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/wheel.imageset/wheel@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/wooden_background.imageset/Amazing-Wooden-Background-For-You.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/wooden_background.imageset/Amazing-Wooden-Background-For-You.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/wooden_background.imageset/Amazing-Wooden-Background-For-You@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/wooden_background.imageset/Amazing-Wooden-Background-For-You@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/wooden_background.imageset/Amazing-Wooden-Background-For-You@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/wooden_background.imageset/Amazing-Wooden-Background-For-You@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/wooden_background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Amazing-Wooden-Background-For-You.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "Amazing-Wooden-Background-For-You@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "Amazing-Wooden-Background-For-You@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/yellow_half.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "yellow_half.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "yellow_half@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "yellow_half@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/yellow_half.imageset/yellow_half.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/yellow_half.imageset/yellow_half.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/yellow_half.imageset/yellow_half@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/yellow_half.imageset/yellow_half@2x.png -------------------------------------------------------------------------------- /RouletteWheel/Assets.xcassets/yellow_half.imageset/yellow_half@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shubhamdhingra98973/RouletteWheel/3510a0995ca9e0291a7c4fa5c9a2c27b8dbd2008/RouletteWheel/Assets.xcassets/yellow_half.imageset/yellow_half@3x.png -------------------------------------------------------------------------------- /RouletteWheel/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /RouletteWheel/Libraries/ButtonPiece.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ButtonPiece.swift 3 | // ButtonWheel 4 | // 5 | // Created by Shubham Dhingra on 01/20/17. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | public struct ButtonPiece { 12 | 13 | var offsetFromDefaultCenter = CGPoint(x: 0, y: 0) 14 | var nameLabel : UILabel? 15 | var backgroundView : UIView 16 | var name : String 17 | var color : UIColor 18 | var numberOfSections : Int = 37 19 | 20 | public init(name : String, color : UIColor, centerOffset : CGPoint) { 21 | self.name = name 22 | self.color = color 23 | self.backgroundView = UIView() 24 | self.offsetFromDefaultCenter = centerOffset 25 | } 26 | 27 | public mutating func setLabel(maxLabelWidth : CGFloat, labelFont : UIFont, textColor : UIColor, index : Int){ 28 | if let nameLabel = self.nameLabel{ 29 | nameLabel.removeFromSuperview() 30 | } 31 | nameLabel = UILabel() 32 | nameLabel?.text = self.name 33 | nameLabel?.textColor = UIColor.white 34 | nameLabel?.font = UIFont.boldSystemFont(ofSize: 8.0) 35 | nameLabel?.numberOfLines = 0 36 | nameLabel?.frame.size = CGSize(width: maxLabelWidth, height: 0) 37 | nameLabel?.sizeToFit() 38 | configureSubviews(index: index) 39 | } 40 | 41 | 42 | 43 | func configureSubviews(index : Int){ 44 | for aSubview in backgroundView.subviews{ 45 | aSubview.removeFromSuperview() 46 | } 47 | 48 | if let nameLabel = nameLabel{ 49 | nameLabel.frame = CGRect(origin: CGPoint(x: offsetFromDefaultCenter.x, y: offsetFromDefaultCenter.y), size: nameLabel.frame.size) 50 | //backgroundView.frame = CGRect(x: nameLabel.frame.origin.x, y:nameLabel.frame.origin.y, width: 14.0, height: 14.0) 51 | backgroundView.frame = nameLabel.frame 52 | nameLabel.transform = CGAffineTransform(rotationAngle: rotateLabelBy(index: index)) 53 | backgroundView.addSubview(nameLabel) 54 | } 55 | } 56 | 57 | func rotateLabelBy(index : Int) -> CGFloat { 58 | var angle : CGFloat? 59 | var rotateIndex : Int? = 0 60 | switch index { 61 | 62 | case 0...17: 63 | rotateIndex = index + 1 64 | 65 | default: 66 | rotateIndex = index - numberOfSections + 1 67 | 68 | } 69 | angle = CGFloat(((Double.pi / 2) / 9.5) * Double(rotateIndex ?? 0)) 70 | return angle ?? 0.0 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /RouletteWheel/Libraries/ButtonViewBuilder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ButtonViewBuilder.swift 3 | // ButtonWheel 4 | // 5 | // Created by Shubham Dhingra on 01/20/17. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | struct ButtonViewBuilder { 12 | 13 | static func createPiece(buttonWheel : ButtonWheel, color : UIColor, sectionNumber : Int) -> CAShapeLayer{ 14 | let startAngle = CGFloat(Double.pi / -2 + Double.pi * 2 / Double(buttonWheel.numberOfSections) * Double(sectionNumber)) 15 | let endAngle = CGFloat(Double.pi / -2 + Double.pi * 2 / Double(buttonWheel.numberOfSections) * Double(sectionNumber + 1)) 16 | let arcCenter = CGPoint(x: buttonWheel.backgroundView.frame.width / 2 ,y: buttonWheel.backgroundView.frame.height / 2) 17 | 18 | 19 | let circlePath = UIBezierPath(arcCenter: arcCenter, radius: CGFloat((buttonWheel.dimensionSize / 2 + buttonWheel.middleRadius) / 2), startAngle: startAngle, endAngle:endAngle, clockwise: true) 20 | 21 | 22 | let shapeLayer = CAShapeLayer() 23 | shapeLayer.path = circlePath.cgPath 24 | 25 | //change the fill color 26 | shapeLayer.fillColor = UIColor.clear.cgColor 27 | //you can change the stroke color 28 | shapeLayer.strokeColor = color.cgColor 29 | //you can change the line width 30 | shapeLayer.lineWidth = buttonWheel.dimensionSize / 2.0 - buttonWheel.middleRadius 31 | return shapeLayer 32 | } 33 | 34 | 35 | static func addButtonBackgroundViewToButton(buttonWheel : ButtonWheel, buttonPiece : ButtonPiece, sectionNumber : Int){ 36 | 37 | let pieceCenter = VectorHelp.getCenterOfPiece(buttonWheel: buttonWheel, sectionNumber: sectionNumber) 38 | print(pieceCenter) 39 | buttonPiece.backgroundView.frame.setCenter(CGPoint(x: pieceCenter.x + buttonPiece.offsetFromDefaultCenter.x, y: pieceCenter.y + buttonPiece.offsetFromDefaultCenter.y)) 40 | buttonWheel.backgroundView.addSubview(buttonPiece.backgroundView) 41 | 42 | } 43 | 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /RouletteWheel/Libraries/ButtonWheel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ButtonWheel.swift 3 | // ButtonWheel 4 | // 5 | // Created by Shubham Dhingra on 01/20/17. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | public protocol ButtonWheelDelegate{ 11 | func didTapButtonWheelAtName(name : String) 12 | } 13 | 14 | public class ButtonWheel : UIView{ 15 | 16 | //border color would be something to add 17 | var shapes = [CAShapeLayer]() 18 | var buttonPieces = [ButtonPiece]() 19 | var buttonNames = [String]() 20 | var numberOfSections = 0 21 | var dimensionSize : CGFloat = 0 22 | var backgroundView = UIView() 23 | var delegate : ButtonWheelDelegate? 24 | var middleRadius : CGFloat = 0 25 | var middleRadiusSetting : MiddleRadiusSize = .medium 26 | 27 | 28 | public required init?(coder aDecoder: NSCoder) { 29 | super.init(coder: aDecoder) 30 | configureBackgroundView() 31 | self.isUserInteractionEnabled = true 32 | } 33 | 34 | public override init(frame: CGRect) { 35 | super.init(frame: frame) 36 | configureBackgroundView() 37 | self.isUserInteractionEnabled = true 38 | } 39 | 40 | func configureBackgroundView(){ 41 | 42 | dimensionSize = self.frame.width < self.frame.height ? self.frame.width : self.frame.height 43 | self.middleRadius = dimensionSize * MiddleRadiusSize.medium.rawValue 44 | self.addSubview(backgroundView) 45 | backgroundView.backgroundColor = UIColor.clear 46 | backgroundView.frame.size = CGSize(width: dimensionSize, height: dimensionSize) 47 | backgroundView.frame.setCenter(CGPoint(x: frame.width / 2, y: frame.height / 2)) 48 | backgroundView.layer.cornerRadius = dimensionSize / 2 49 | backgroundView.clipsToBounds = true 50 | 51 | } 52 | 53 | public func setupWith(buttonPieces : [ButtonPiece], middleRadius : MiddleRadiusSize){ 54 | destroy() 55 | 56 | self.buttonPieces = buttonPieces 57 | self.middleRadiusSetting = middleRadius 58 | self.middleRadius = dimensionSize * middleRadiusSetting.rawValue 59 | self.numberOfSections = buttonPieces.count 60 | for aSubview in backgroundView.subviews{ 61 | aSubview.removeFromSuperview() 62 | 63 | } 64 | 65 | for (index, aButtonPiece) in buttonPieces.enumerated(){ 66 | let newPieceLayer = ButtonViewBuilder.createPiece(buttonWheel: self, color: aButtonPiece.color, sectionNumber: index) 67 | print("Indexx",index) 68 | backgroundView.layer.addSublayer(newPieceLayer) 69 | shapes.append(newPieceLayer) 70 | buttonNames.append(aButtonPiece.name) 71 | ButtonViewBuilder.addButtonBackgroundViewToButton(buttonWheel: self, buttonPiece: aButtonPiece, sectionNumber: index) 72 | } 73 | } 74 | 75 | func destroy(){ 76 | for aPiece in buttonPieces{ 77 | aPiece.backgroundView.removeFromSuperview() 78 | } 79 | 80 | buttonPieces = [] 81 | 82 | for aShape in shapes{ 83 | aShape.removeFromSuperlayer() 84 | } 85 | shapes = [] 86 | } 87 | 88 | override public func touchesBegan(_ touches: Set, with event: UIEvent?) { 89 | let touch = touches.first! 90 | let tappedPoint = touch.location(in: self) 91 | let buttonName = TouchManagement.getNameFromPoint(buttonWheel: self, tappedPoint: tappedPoint) 92 | 93 | guard let unwrappedButtonName = buttonName else { 94 | return 95 | } 96 | delegate?.didTapButtonWheelAtName(name: unwrappedButtonName) 97 | } 98 | } 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /RouletteWheel/Libraries/Enums.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Enums.swift 3 | // ButtonWheel 4 | // 5 | // Created by Shubham Dhingra on 01/20/17. 6 | 7 | import Foundation 8 | import UIKit 9 | 10 | public enum MiddleRadiusSize : CGFloat{ 11 | case small = 0.30, medium = 0.33, large = 0.36 12 | } 13 | 14 | //MARK: - Ball/NumberView Animation 15 | enum AnimationObject { 16 | case Number 17 | case BackImage 18 | } 19 | 20 | //MARK: - Animation Type 21 | enum AnimationTypes: String { 22 | 23 | case zRotation = "transform.rotation.z" 24 | case animation = "rotationAnimation" 25 | } 26 | -------------------------------------------------------------------------------- /RouletteWheel/Libraries/PDFloraButton.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PDFloraButton.swift 3 | // PDFloraButton 4 | // 5 | // Created by Dhingra on 18/12/17. 6 | // Copyright � 2016 Priyam Dutta. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | enum ButtonPosition { 12 | case center 13 | case topLeft 14 | case topRight 15 | case bottomLeft 16 | case bottomRight 17 | case midTop 18 | case midBottom 19 | case midLeft 20 | case midRight 21 | } 22 | 23 | func getRadian(degree: CGFloat) -> CGFloat { 24 | return CGFloat(degree * .pi/180) 25 | } 26 | 27 | class PDFloraButton: UIButton { 28 | 29 | private let radius: CGFloat = 110.0 30 | private let childButtonSize: CGFloat = 30.0 31 | private let circumference: CGFloat = 360.0 32 | private let delayInterval = 0.0 33 | private let duration = 0.25 34 | private let damping: CGFloat = 0.9 35 | private let initialVelocity: CGFloat = 0.9 36 | private var anchorPoint: CGPoint! 37 | 38 | private var xPadding: CGFloat = 10.0 39 | private var yPadding: CGFloat = 10.0 40 | private var buttonSize: CGFloat = 0.0 41 | private var childButtons = 0 42 | private var buttonPosition: ButtonPosition = .center 43 | private var childButtonsArray = [UIButton]() 44 | private var degree: CGFloat = 0.0 45 | private var imageArray = [String]() 46 | 47 | // var arr = [Int]() 48 | var isOpen = false 49 | var buttonActionDidSelected: ((_ indexSelected: Int)->())! 50 | // var view : UIView? 51 | 52 | convenience init(withPosition position : ButtonPosition , size: CGFloat, numberOfPetals: Int, images: [String], arr: [Int] , numberView : UIView?) { 53 | self.init(frame: CGRect(x: 0, y: 0, width: size, height: size)) 54 | // self.frame = (numberView?.frame)! 55 | // self.init(frame : (numberView?.frame)!) 56 | self.layer.cornerRadius = size / 2.0 57 | childButtons = numberOfPetals 58 | buttonPosition = position 59 | imageArray = images 60 | 61 | DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(0.01 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)) { 62 | self.center = CGPoint(x: (numberView?.frame)!.midX, y: (numberView?.frame)!.midY) 63 | self.anchorPoint = self.center 64 | self.createButtons(numbers: numberOfPetals, arr: arr) 65 | } 66 | } 67 | 68 | 69 | override init(frame: CGRect) { 70 | super.init(frame: frame) 71 | backgroundColor = .clear 72 | self.addTarget(self, action: #selector(self.animateChildButtons(_:)), for: .touchUpInside) 73 | } 74 | 75 | required init?(coder aDecoder: NSCoder) { 76 | fatalError("init(coder:) has not been implemented") 77 | } 78 | 79 | // Create Buttons 80 | func createButtons(numbers: Int, arr: [Int]) { 81 | 82 | for index in 0.. String?{ 15 | let centerPoint = CGPoint(x: buttonWheel.frame.width / 2, y: buttonWheel.frame.height / 2) 16 | 17 | let angle = VectorHelp.angleFromPoints(centerPoint: centerPoint, tappedPoint: tappedPoint) 18 | let distance = CGFloat(VectorHelp.distanceFromCenter(centerPoint: centerPoint, tappedPoint: tappedPoint)) 19 | let numberOfButtons = buttonWheel.buttonNames.count 20 | 21 | if distance > buttonWheel.dimensionSize || distance < buttonWheel.middleRadius{ 22 | return nil 23 | } 24 | 25 | let index = Int(angle * Double(numberOfButtons) / VectorHelp.twoPi) 26 | 27 | return buttonWheel.buttonNames[index] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /RouletteWheel/Libraries/UsefulExtensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UsefulExtensions.swift 3 | // ButtonWheel 4 | // 5 | // Created by Shubham Dhingra on 01/20/17. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | extension CGRect { 12 | mutating func setCenter(_ point : CGPoint){ 13 | self.origin = CGPoint(x: point.x - self.width / 2, y: point.y - self.height / 2) 14 | } 15 | } 16 | 17 | extension UIView { 18 | 19 | //MARK: - Bounce Animation 20 | func springAnimate() { 21 | 22 | self.transform = CGAffineTransform.identity 23 | self.transform = CGAffineTransform(scaleX: 0.58, y: 0.58) 24 | 25 | UIView.animate(withDuration: 1.5, 26 | delay: 0, 27 | usingSpringWithDamping: 0.9, 28 | initialSpringVelocity: 0.6, 29 | options: [.curveEaseInOut], 30 | animations: { 31 | self.transform = CGAffineTransform.identity 32 | self.transform = CGAffineTransform(scaleX: 0.58, y: 0.58) 33 | }, 34 | completion: { finish in 35 | if CreateWheel.numberOfCollisions < 2 { 36 | self.springAnimate() 37 | } 38 | CreateWheel.numberOfCollisions += 1 39 | }) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /RouletteWheel/Libraries/VectorHelp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VectorHelp.swift 3 | // ButtonWheel 4 | // 5 | // Created by Shubham Dhingra on 01/20/17. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | class VectorHelp { 12 | 13 | static let twoPi = Double.pi * 2 14 | 15 | 16 | static func angleFromPoints(centerPoint : CGPoint, tappedPoint : CGPoint) -> Double{ 17 | let translatedX = Double(tappedPoint.x - centerPoint.x) 18 | let translatedY = -1 * Double(tappedPoint.y - centerPoint.y) // the negative is to flip it since y in math increases as you go up 19 | 20 | var messedUpResult = atan(translatedY / translatedX) 21 | if translatedX < 0{ 22 | messedUpResult += Double.pi 23 | } 24 | else if translatedY < 0{ 25 | messedUpResult += twoPi 26 | } 27 | //messUpResult now follows math convention for radians 28 | //However for our purposes, we want it to increase clockwise and start with 0 radians on top, which is the next step 29 | var translatedResult = twoPi - messedUpResult //flips it to increase angle clockwise 30 | translatedResult += Double.pi / 2 31 | if translatedY > 0 && translatedX > 0 { 32 | translatedResult -= twoPi 33 | } 34 | return translatedResult 35 | } 36 | 37 | 38 | static func distanceFromCenter(centerPoint : CGPoint, tappedPoint : CGPoint) -> Double{ 39 | let xdiff = centerPoint.x - tappedPoint.x 40 | let ydiff = centerPoint.y - tappedPoint.y 41 | let squaredDistance = xdiff * xdiff + ydiff * ydiff 42 | 43 | 44 | return sqrt(Double(squaredDistance)) 45 | } 46 | 47 | static func getCenterOfPiece(buttonWheel : ButtonWheel, sectionNumber : Int) -> CGPoint{ 48 | var distance : Double = 0 49 | 50 | //This doesn't give the true middle for wheels with a small center radius. Instead it looks for a point closer to the outside 51 | //where there's more space. More space is ideal for placing the labels and images 52 | if buttonWheel.middleRadiusSetting == .small{ 53 | distance = Double(buttonWheel.dimensionSize / 2 - (buttonWheel.dimensionSize / 2 - buttonWheel.middleRadius) / 2.5) 54 | 55 | } 56 | else{ 57 | //distance = Double(buttonWheel.dimensionSize / 2 - (buttonWheel.dimensionSize / 2 - buttonWheel.middleRadius) / 2) 58 | distance = Double(buttonWheel.dimensionSize / 1.75 - (buttonWheel.dimensionSize / 1.75 - buttonWheel.middleRadius) / 1.75) 59 | } 60 | 61 | 62 | let ratioOfCircleToCenterOfPiece = Double(sectionNumber) / Double(buttonWheel.numberOfSections) + 0.5 / Double(buttonWheel.numberOfSections) 63 | let angle = twoPi * ratioOfCircleToCenterOfPiece 64 | let tranformedAngle = angle * -1 + Double.pi / 2 //need to transform sincr we defined a polar coordinate system that starts at the top and advances clockwise 65 | 66 | let uncorrectedCenter = CGPoint(x: cos(tranformedAngle) * distance , y: sin(tranformedAngle) * distance * -1) 67 | 68 | //Now we need to add in the mid point coordinates to correct 69 | return CGPoint(x: uncorrectedCenter.x + buttonWheel.backgroundView.frame.midX, y: uncorrectedCenter.y + buttonWheel.backgroundView.frame.midY) 70 | } 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | } 79 | -------------------------------------------------------------------------------- /RouletteWheel/StoryBoard/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /RouletteWheel/StoryBoard/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Georgia-Bold 16 | 17 | 18 | Georgia-BoldItalic 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /RouletteWheel/WheelControllers/CreateWheel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CreateWheel.swift 3 | // RouletteWheelGame 4 | // 5 | // Created by Shubham Dhingra on 01/20/17. 6 | // Copyright © 2017 OSX. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | class CreateWheel { 13 | 14 | static var numberOfCollisions :Int = 0 15 | 16 | static func makeButtonArray(buttonArr : [Int]) -> [ButtonPiece]{ 17 | let buttonNames = buttonArr 18 | let myFont = UIFont(name: "Avenir", size: 10.0) 19 | let fontColor = UIColor.white 20 | let labelLength : CGFloat = 40.0 21 | var buttonArray : [ButtonPiece] = [] 22 | 23 | for (index, aName) in buttonNames.enumerated(){ 24 | 25 | var newButton = ButtonPiece(name: String(aName), color: .clear, centerOffset: CGPoint(x: 0, y: 0)) 26 | if let myFont = myFont{ 27 | newButton.setLabel(maxLabelWidth: labelLength, labelFont: myFont, textColor: fontColor , index : index) 28 | } 29 | else{ 30 | print("Must use valid font") 31 | } 32 | 33 | buttonArray.append(newButton) 34 | 35 | } 36 | return buttonArray 37 | } 38 | 39 | static var array : [Int] = { 40 | return [0, 36, 65, 35, 199, 89, 133, 149, 73, 105, 125, 63, 99, 52, 55, 49, 175, 45, 195, 123, 59, 27, 189, 0, 85, 33, 78, 100, 93, 187, 69, 137, 25, 75, 41, 113, 120] 41 | }() 42 | } 43 | 44 | //MARK:- UITextField Delegate 45 | extension WheelVC: UITextFieldDelegate{ 46 | 47 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 48 | 49 | guard let nextTf = textField.superview?.viewWithTag(textField.tag + 1) as? UITextField else { textField.resignFirstResponder(); return true } 50 | nextTf.becomeFirstResponder() 51 | return false 52 | } 53 | } 54 | 55 | //MARK: - CABasicAnimation Extension 56 | extension CABasicAnimation { 57 | func setUpAnimation() { 58 | self.repeatCount = 0 59 | self.isRemovedOnCompletion = false 60 | self.fillMode = kCAFillModeForwards 61 | self.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /RouletteWheel/WheelControllers/WheelVC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // RouletteWheel 4 | // 5 | // Created by Shubham Dhingra on 01/20/17. 6 | // Copyright © 2017 OSX. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import GLKit 11 | import SpriteKit 12 | 13 | class WheelVC : UIViewController { 14 | 15 | //MARK::- OUTLETS 16 | @IBOutlet weak var imgInnerWheel : UIImageView? 17 | @IBOutlet weak var imgOuterWheel : UIImageView? 18 | @IBOutlet weak var imgBall : UIImageView? 19 | @IBOutlet weak var numberView : ButtonWheel? 20 | @IBOutlet weak var txtNumber : UITextField? 21 | @IBOutlet weak var btnRotate : UIButton? 22 | 23 | //MARK::- VARIABLES 24 | var numberArr = [Int]() 25 | 26 | /// Roulette Numbers 27 | var realNumbers :[Int] = CreateWheel.array 28 | var numberIndex = 0.0 29 | 30 | /// Number Of Rotations 31 | var numberOfRotation = 5.0 32 | var radianOfSector = 0.16929 33 | var index = 0 34 | 35 | override func viewDidLoad() { 36 | super.viewDidLoad() 37 | onViewDidLoad() 38 | } 39 | 40 | //MARK: - Append Numbers 41 | func appendNumbers(){ 42 | numberArr = [] 43 | while index < 37 { 44 | numberArr.append(index) 45 | index += 1 46 | } 47 | } 48 | 49 | //MARK: - OnViewDidLoad 50 | func onViewDidLoad() { 51 | self.imgBall?.transform = (self.imgBall?.transform.rotated(by: -0.42345))! 52 | self.imgInnerWheel?.transform = (self.imgInnerWheel?.transform.rotated(by: 0.0174533))! 53 | self.appendNumbers() 54 | numberView?.transform = CGAffineTransform(rotationAngle: -0.0695) 55 | numberView?.setupWith(buttonPieces: CreateWheel.makeButtonArray(buttonArr: realNumbers), middleRadius: .medium) 56 | } 57 | 58 | //MARK: - Rotate button Action 59 | @IBAction func btnActionRotate(_ sender: Any) { 60 | 61 | if let number = Int(txtNumber?.text ?? "") { 62 | 63 | numberIndex = Double(self.getIndex(number)) 64 | 65 | //when the entered number not in the list 66 | if numberIndex == -1 { 67 | txtNumber?.text = nil 68 | showAlert() 69 | return 70 | } 71 | self.imgBall!.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) 72 | self.view.isUserInteractionEnabled = false 73 | btnRotate?.isHidden = true 74 | DispatchQueue.main.asyncAfter(deadline: .now() + 12.5, execute: { 75 | self.btnRotate?.isHidden = false 76 | self.view.isUserInteractionEnabled = true 77 | }) 78 | } 79 | 80 | self.removeAllAnimations() 81 | CreateWheel.numberOfCollisions = 0 82 | rotateWheel() 83 | } 84 | 85 | func showAlert() { 86 | 87 | let alert = UIAlertController(title: "Alert", message: "Please choose number from wheel The entered number is not present in wheel", preferredStyle: UIAlertControllerStyle.alert) 88 | alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)) 89 | self.present(alert, animated: true, completion: nil) 90 | } 91 | 92 | //MARK: - Remove Animations 93 | func removeAllAnimations() { 94 | self.imgBall!.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) 95 | self.imgInnerWheel?.layer.removeAllAnimations() 96 | self.imgBall?.layer.removeAnimation(forKey: AnimationTypes.animation.rawValue) 97 | self.numberView?.layer.removeAllAnimations() 98 | } 99 | 100 | //MARK: - Get Index of element 101 | func getIndex(_ chosenIndex: Int ) -> Int { 102 | return realNumbers.contains(chosenIndex) ? (realNumbers.index(of: chosenIndex) ?? -1) : -1 103 | } 104 | 105 | //MARK: - Rotate Wheel 106 | func rotateWheel() { 107 | self.numberView?.layer.add(self.animation(type: .Number), forKey: AnimationTypes.animation.rawValue) 108 | self.imgInnerWheel?.layer.add(self.animation(type: .BackImage), forKey: AnimationTypes.animation.rawValue) 109 | self.imgBall?.layer.add(self.ballanimation(), forKey: AnimationTypes.animation.rawValue) 110 | UIView.animate(withDuration: 15.5, delay: 0.0, options: .curveEaseOut, animations: { 111 | DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3), execute: { 112 | self.view.layoutIfNeeded() 113 | self.ballTransForm() 114 | })}) 115 | } 116 | 117 | //MARK: - Scaling Ball 118 | func ballTransForm() { 119 | UIView.animate(withDuration: 4.0,delay: 1.0 , options: [.curveEaseIn , .curveEaseInOut ],animations: { 120 | let transform = CGAffineTransform(scaleX: 0.62, y: 0.62) 121 | self.imgBall?.transform = transform 122 | }){ finished in 123 | self.imgBall!.springAnimate() 124 | } 125 | } 126 | } 127 | 128 | 129 | //MARK::- CABasicAnimation 130 | extension WheelVC { 131 | 132 | //MARK: - Ball Animation and Rotation 133 | func ballanimation() -> CABasicAnimation{ 134 | let rotateView = CABasicAnimation(keyPath: AnimationTypes.zRotation.rawValue) 135 | rotateView.fromValue = -0.42345 136 | let angle = numberIndex != 0.0 ? ((((numberIndex * radianOfSector) / 2) * 3) - radianOfSector - 0.23316) : -0.42345 137 | rotateView.toValue = NSNumber(value : -((numberOfRotation * Double.pi) - (angle))) 138 | rotateView.duration = 12.5 139 | rotateView.setUpAnimation() 140 | return rotateView 141 | } 142 | 143 | //MARK: -Inner Wheel Rotation 144 | func animation(type: AnimationObject) -> CABasicAnimation{ 145 | let rotateView = CABasicAnimation(keyPath: AnimationTypes.zRotation.rawValue) 146 | let angle = (numberIndex * (radianOfSector / 2)) 147 | let value = NSNumber(value : (numberOfRotation * Double.pi) + angle - (type == .BackImage ? 0.0 : 0.0695 ) ) 148 | rotateView.toValue = value 149 | rotateView.duration = 10 150 | rotateView.setUpAnimation() 151 | return rotateView 152 | } 153 | } 154 | 155 | 156 | //MARK::- Textfield Delegate 157 | extension WheelVC { 158 | 159 | override func touchesBegan(_ touches: Set, with event: UIEvent?) { 160 | self.view.endEditing(true) 161 | } 162 | 163 | } 164 | -------------------------------------------------------------------------------- /RouletteWheelGame.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 102240A11FE78101005AA5F8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 102240A01FE78101005AA5F8 /* Assets.xcassets */; }; 11 | 102240AF1FE78101005AA5F8 /* RouletteWheelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240AE1FE78101005AA5F8 /* RouletteWheelTests.swift */; }; 12 | 102240BA1FE78101005AA5F8 /* RouletteWheelUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240B91FE78101005AA5F8 /* RouletteWheelUITests.swift */; }; 13 | 102240D31FE7A01B005AA5F8 /* WheelVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240CB1FE7A01B005AA5F8 /* WheelVC.swift */; }; 14 | 102240D41FE7A01B005AA5F8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240CD1FE7A01B005AA5F8 /* AppDelegate.swift */; }; 15 | 102240D61FE7A01B005AA5F8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 102240D11FE7A01B005AA5F8 /* LaunchScreen.storyboard */; }; 16 | 102240D71FE7A01B005AA5F8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 102240D21FE7A01B005AA5F8 /* Main.storyboard */; }; 17 | 102240DB1FE7DC04005AA5F8 /* ButtonPiece.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240DA1FE7DC04005AA5F8 /* ButtonPiece.swift */; }; 18 | 102240DD1FE7DC0B005AA5F8 /* ButtonWheel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240DC1FE7DC0A005AA5F8 /* ButtonWheel.swift */; }; 19 | 102240E01FE7DD07005AA5F8 /* Enums.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240DE1FE7DD06005AA5F8 /* Enums.swift */; }; 20 | 102240E11FE7DD07005AA5F8 /* UsefulExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240DF1FE7DD06005AA5F8 /* UsefulExtensions.swift */; }; 21 | 102240E51FE7DD2B005AA5F8 /* ButtonViewBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240E21FE7DD2B005AA5F8 /* ButtonViewBuilder.swift */; }; 22 | 102240E61FE7DD2B005AA5F8 /* VectorHelp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240E31FE7DD2B005AA5F8 /* VectorHelp.swift */; }; 23 | 102240E71FE7DD2B005AA5F8 /* TouchManagement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 102240E41FE7DD2B005AA5F8 /* TouchManagement.swift */; }; 24 | 10BDCF2F1FEA4E1100FA49CF /* CreateWheel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10BDCF2E1FEA4E1100FA49CF /* CreateWheel.swift */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | 102240AB1FE78101005AA5F8 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 1022408E1FE78100005AA5F8 /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 102240951FE78101005AA5F8; 33 | remoteInfo = RouletteWheel; 34 | }; 35 | 102240B61FE78101005AA5F8 /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = 1022408E1FE78100005AA5F8 /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = 102240951FE78101005AA5F8; 40 | remoteInfo = RouletteWheel; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 102240961FE78101005AA5F8 /* RouletteWheelGame.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RouletteWheelGame.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 102240A01FE78101005AA5F8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | 102240A51FE78101005AA5F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 102240AA1FE78101005AA5F8 /* RouletteWheelGameTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RouletteWheelGameTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 102240AE1FE78101005AA5F8 /* RouletteWheelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouletteWheelTests.swift; sourceTree = ""; }; 50 | 102240B01FE78101005AA5F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 102240B51FE78101005AA5F8 /* RouletteWheelGameUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RouletteWheelGameUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 102240B91FE78101005AA5F8 /* RouletteWheelUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouletteWheelUITests.swift; sourceTree = ""; }; 53 | 102240BB1FE78101005AA5F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 102240CB1FE7A01B005AA5F8 /* WheelVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WheelVC.swift; sourceTree = ""; }; 55 | 102240CD1FE7A01B005AA5F8 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 56 | 102240D11FE7A01B005AA5F8 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 57 | 102240D21FE7A01B005AA5F8 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 58 | 102240DA1FE7DC04005AA5F8 /* ButtonPiece.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonPiece.swift; sourceTree = ""; }; 59 | 102240DC1FE7DC0A005AA5F8 /* ButtonWheel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonWheel.swift; sourceTree = ""; }; 60 | 102240DE1FE7DD06005AA5F8 /* Enums.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Enums.swift; sourceTree = ""; }; 61 | 102240DF1FE7DD06005AA5F8 /* UsefulExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UsefulExtensions.swift; sourceTree = ""; }; 62 | 102240E21FE7DD2B005AA5F8 /* ButtonViewBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonViewBuilder.swift; sourceTree = ""; }; 63 | 102240E31FE7DD2B005AA5F8 /* VectorHelp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VectorHelp.swift; sourceTree = ""; }; 64 | 102240E41FE7DD2B005AA5F8 /* TouchManagement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TouchManagement.swift; sourceTree = ""; }; 65 | 10BDCF2E1FEA4E1100FA49CF /* CreateWheel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateWheel.swift; sourceTree = ""; }; 66 | /* End PBXFileReference section */ 67 | 68 | /* Begin PBXFrameworksBuildPhase section */ 69 | 102240931FE78101005AA5F8 /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | 102240A71FE78101005AA5F8 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | 102240B21FE78101005AA5F8 /* Frameworks */ = { 84 | isa = PBXFrameworksBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | /* End PBXFrameworksBuildPhase section */ 91 | 92 | /* Begin PBXGroup section */ 93 | 1022408D1FE78100005AA5F8 = { 94 | isa = PBXGroup; 95 | children = ( 96 | 102240981FE78101005AA5F8 /* RouletteWheel */, 97 | 102240AD1FE78101005AA5F8 /* RouletteWheelTests */, 98 | 102240B81FE78101005AA5F8 /* RouletteWheelUITests */, 99 | 102240971FE78101005AA5F8 /* Products */, 100 | ); 101 | sourceTree = ""; 102 | }; 103 | 102240971FE78101005AA5F8 /* Products */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 102240961FE78101005AA5F8 /* RouletteWheelGame.app */, 107 | 102240AA1FE78101005AA5F8 /* RouletteWheelGameTests.xctest */, 108 | 102240B51FE78101005AA5F8 /* RouletteWheelGameUITests.xctest */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 102240981FE78101005AA5F8 /* RouletteWheel */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 102240CC1FE7A01B005AA5F8 /* AppDelegate */, 117 | 102240CE1FE7A01B005AA5F8 /* Libraries */, 118 | 102240D01FE7A01B005AA5F8 /* StoryBoard */, 119 | 102240CA1FE7A01B005AA5F8 /* WheelControllers */, 120 | 102240A01FE78101005AA5F8 /* Assets.xcassets */, 121 | 102240A51FE78101005AA5F8 /* Info.plist */, 122 | ); 123 | path = RouletteWheel; 124 | sourceTree = ""; 125 | }; 126 | 102240AD1FE78101005AA5F8 /* RouletteWheelTests */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 102240AE1FE78101005AA5F8 /* RouletteWheelTests.swift */, 130 | 102240B01FE78101005AA5F8 /* Info.plist */, 131 | ); 132 | path = RouletteWheelTests; 133 | sourceTree = ""; 134 | }; 135 | 102240B81FE78101005AA5F8 /* RouletteWheelUITests */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 102240B91FE78101005AA5F8 /* RouletteWheelUITests.swift */, 139 | 102240BB1FE78101005AA5F8 /* Info.plist */, 140 | ); 141 | path = RouletteWheelUITests; 142 | sourceTree = ""; 143 | }; 144 | 102240CA1FE7A01B005AA5F8 /* WheelControllers */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 102240CB1FE7A01B005AA5F8 /* WheelVC.swift */, 148 | 10BDCF2E1FEA4E1100FA49CF /* CreateWheel.swift */, 149 | ); 150 | path = WheelControllers; 151 | sourceTree = ""; 152 | }; 153 | 102240CC1FE7A01B005AA5F8 /* AppDelegate */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 102240CD1FE7A01B005AA5F8 /* AppDelegate.swift */, 157 | ); 158 | path = AppDelegate; 159 | sourceTree = ""; 160 | }; 161 | 102240CE1FE7A01B005AA5F8 /* Libraries */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 102240E21FE7DD2B005AA5F8 /* ButtonViewBuilder.swift */, 165 | 102240E41FE7DD2B005AA5F8 /* TouchManagement.swift */, 166 | 102240E31FE7DD2B005AA5F8 /* VectorHelp.swift */, 167 | 102240DE1FE7DD06005AA5F8 /* Enums.swift */, 168 | 102240DF1FE7DD06005AA5F8 /* UsefulExtensions.swift */, 169 | 102240DC1FE7DC0A005AA5F8 /* ButtonWheel.swift */, 170 | 102240DA1FE7DC04005AA5F8 /* ButtonPiece.swift */, 171 | ); 172 | path = Libraries; 173 | sourceTree = ""; 174 | }; 175 | 102240D01FE7A01B005AA5F8 /* StoryBoard */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 102240D11FE7A01B005AA5F8 /* LaunchScreen.storyboard */, 179 | 102240D21FE7A01B005AA5F8 /* Main.storyboard */, 180 | ); 181 | path = StoryBoard; 182 | sourceTree = ""; 183 | }; 184 | /* End PBXGroup section */ 185 | 186 | /* Begin PBXNativeTarget section */ 187 | 102240951FE78101005AA5F8 /* RouletteWheelGame */ = { 188 | isa = PBXNativeTarget; 189 | buildConfigurationList = 102240BE1FE78101005AA5F8 /* Build configuration list for PBXNativeTarget "RouletteWheelGame" */; 190 | buildPhases = ( 191 | 102240921FE78101005AA5F8 /* Sources */, 192 | 102240931FE78101005AA5F8 /* Frameworks */, 193 | 102240941FE78101005AA5F8 /* Resources */, 194 | ); 195 | buildRules = ( 196 | ); 197 | dependencies = ( 198 | ); 199 | name = RouletteWheelGame; 200 | productName = RouletteWheel; 201 | productReference = 102240961FE78101005AA5F8 /* RouletteWheelGame.app */; 202 | productType = "com.apple.product-type.application"; 203 | }; 204 | 102240A91FE78101005AA5F8 /* RouletteWheelGameTests */ = { 205 | isa = PBXNativeTarget; 206 | buildConfigurationList = 102240C11FE78101005AA5F8 /* Build configuration list for PBXNativeTarget "RouletteWheelGameTests" */; 207 | buildPhases = ( 208 | 102240A61FE78101005AA5F8 /* Sources */, 209 | 102240A71FE78101005AA5F8 /* Frameworks */, 210 | 102240A81FE78101005AA5F8 /* Resources */, 211 | ); 212 | buildRules = ( 213 | ); 214 | dependencies = ( 215 | 102240AC1FE78101005AA5F8 /* PBXTargetDependency */, 216 | ); 217 | name = RouletteWheelGameTests; 218 | productName = RouletteWheelTests; 219 | productReference = 102240AA1FE78101005AA5F8 /* RouletteWheelGameTests.xctest */; 220 | productType = "com.apple.product-type.bundle.unit-test"; 221 | }; 222 | 102240B41FE78101005AA5F8 /* RouletteWheelGameUITests */ = { 223 | isa = PBXNativeTarget; 224 | buildConfigurationList = 102240C41FE78101005AA5F8 /* Build configuration list for PBXNativeTarget "RouletteWheelGameUITests" */; 225 | buildPhases = ( 226 | 102240B11FE78101005AA5F8 /* Sources */, 227 | 102240B21FE78101005AA5F8 /* Frameworks */, 228 | 102240B31FE78101005AA5F8 /* Resources */, 229 | ); 230 | buildRules = ( 231 | ); 232 | dependencies = ( 233 | 102240B71FE78101005AA5F8 /* PBXTargetDependency */, 234 | ); 235 | name = RouletteWheelGameUITests; 236 | productName = RouletteWheelUITests; 237 | productReference = 102240B51FE78101005AA5F8 /* RouletteWheelGameUITests.xctest */; 238 | productType = "com.apple.product-type.bundle.ui-testing"; 239 | }; 240 | /* End PBXNativeTarget section */ 241 | 242 | /* Begin PBXProject section */ 243 | 1022408E1FE78100005AA5F8 /* Project object */ = { 244 | isa = PBXProject; 245 | attributes = { 246 | LastSwiftUpdateCheck = 0920; 247 | LastUpgradeCheck = 0920; 248 | ORGANIZATIONNAME = OSX; 249 | TargetAttributes = { 250 | 102240951FE78101005AA5F8 = { 251 | CreatedOnToolsVersion = 9.2; 252 | ProvisioningStyle = Automatic; 253 | }; 254 | 102240A91FE78101005AA5F8 = { 255 | CreatedOnToolsVersion = 9.2; 256 | ProvisioningStyle = Automatic; 257 | TestTargetID = 102240951FE78101005AA5F8; 258 | }; 259 | 102240B41FE78101005AA5F8 = { 260 | CreatedOnToolsVersion = 9.2; 261 | ProvisioningStyle = Automatic; 262 | TestTargetID = 102240951FE78101005AA5F8; 263 | }; 264 | }; 265 | }; 266 | buildConfigurationList = 102240911FE78100005AA5F8 /* Build configuration list for PBXProject "RouletteWheelGame" */; 267 | compatibilityVersion = "Xcode 8.0"; 268 | developmentRegion = en; 269 | hasScannedForEncodings = 0; 270 | knownRegions = ( 271 | en, 272 | Base, 273 | ); 274 | mainGroup = 1022408D1FE78100005AA5F8; 275 | productRefGroup = 102240971FE78101005AA5F8 /* Products */; 276 | projectDirPath = ""; 277 | projectRoot = ""; 278 | targets = ( 279 | 102240951FE78101005AA5F8 /* RouletteWheelGame */, 280 | 102240A91FE78101005AA5F8 /* RouletteWheelGameTests */, 281 | 102240B41FE78101005AA5F8 /* RouletteWheelGameUITests */, 282 | ); 283 | }; 284 | /* End PBXProject section */ 285 | 286 | /* Begin PBXResourcesBuildPhase section */ 287 | 102240941FE78101005AA5F8 /* Resources */ = { 288 | isa = PBXResourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | 102240D71FE7A01B005AA5F8 /* Main.storyboard in Resources */, 292 | 102240A11FE78101005AA5F8 /* Assets.xcassets in Resources */, 293 | 102240D61FE7A01B005AA5F8 /* LaunchScreen.storyboard in Resources */, 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | 102240A81FE78101005AA5F8 /* Resources */ = { 298 | isa = PBXResourcesBuildPhase; 299 | buildActionMask = 2147483647; 300 | files = ( 301 | ); 302 | runOnlyForDeploymentPostprocessing = 0; 303 | }; 304 | 102240B31FE78101005AA5F8 /* Resources */ = { 305 | isa = PBXResourcesBuildPhase; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | /* End PBXResourcesBuildPhase section */ 312 | 313 | /* Begin PBXSourcesBuildPhase section */ 314 | 102240921FE78101005AA5F8 /* Sources */ = { 315 | isa = PBXSourcesBuildPhase; 316 | buildActionMask = 2147483647; 317 | files = ( 318 | 102240D41FE7A01B005AA5F8 /* AppDelegate.swift in Sources */, 319 | 102240DB1FE7DC04005AA5F8 /* ButtonPiece.swift in Sources */, 320 | 102240E61FE7DD2B005AA5F8 /* VectorHelp.swift in Sources */, 321 | 102240E51FE7DD2B005AA5F8 /* ButtonViewBuilder.swift in Sources */, 322 | 102240DD1FE7DC0B005AA5F8 /* ButtonWheel.swift in Sources */, 323 | 102240E71FE7DD2B005AA5F8 /* TouchManagement.swift in Sources */, 324 | 102240E01FE7DD07005AA5F8 /* Enums.swift in Sources */, 325 | 102240E11FE7DD07005AA5F8 /* UsefulExtensions.swift in Sources */, 326 | 102240D31FE7A01B005AA5F8 /* WheelVC.swift in Sources */, 327 | 10BDCF2F1FEA4E1100FA49CF /* CreateWheel.swift in Sources */, 328 | ); 329 | runOnlyForDeploymentPostprocessing = 0; 330 | }; 331 | 102240A61FE78101005AA5F8 /* Sources */ = { 332 | isa = PBXSourcesBuildPhase; 333 | buildActionMask = 2147483647; 334 | files = ( 335 | 102240AF1FE78101005AA5F8 /* RouletteWheelTests.swift in Sources */, 336 | ); 337 | runOnlyForDeploymentPostprocessing = 0; 338 | }; 339 | 102240B11FE78101005AA5F8 /* Sources */ = { 340 | isa = PBXSourcesBuildPhase; 341 | buildActionMask = 2147483647; 342 | files = ( 343 | 102240BA1FE78101005AA5F8 /* RouletteWheelUITests.swift in Sources */, 344 | ); 345 | runOnlyForDeploymentPostprocessing = 0; 346 | }; 347 | /* End PBXSourcesBuildPhase section */ 348 | 349 | /* Begin PBXTargetDependency section */ 350 | 102240AC1FE78101005AA5F8 /* PBXTargetDependency */ = { 351 | isa = PBXTargetDependency; 352 | target = 102240951FE78101005AA5F8 /* RouletteWheelGame */; 353 | targetProxy = 102240AB1FE78101005AA5F8 /* PBXContainerItemProxy */; 354 | }; 355 | 102240B71FE78101005AA5F8 /* PBXTargetDependency */ = { 356 | isa = PBXTargetDependency; 357 | target = 102240951FE78101005AA5F8 /* RouletteWheelGame */; 358 | targetProxy = 102240B61FE78101005AA5F8 /* PBXContainerItemProxy */; 359 | }; 360 | /* End PBXTargetDependency section */ 361 | 362 | /* Begin XCBuildConfiguration section */ 363 | 102240BC1FE78101005AA5F8 /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | ALWAYS_SEARCH_USER_PATHS = NO; 367 | CLANG_ANALYZER_NONNULL = YES; 368 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 369 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 370 | CLANG_CXX_LIBRARY = "libc++"; 371 | CLANG_ENABLE_MODULES = YES; 372 | CLANG_ENABLE_OBJC_ARC = YES; 373 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 374 | CLANG_WARN_BOOL_CONVERSION = YES; 375 | CLANG_WARN_COMMA = YES; 376 | CLANG_WARN_CONSTANT_CONVERSION = YES; 377 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 378 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 379 | CLANG_WARN_EMPTY_BODY = YES; 380 | CLANG_WARN_ENUM_CONVERSION = YES; 381 | CLANG_WARN_INFINITE_RECURSION = YES; 382 | CLANG_WARN_INT_CONVERSION = YES; 383 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 384 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 385 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 386 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 387 | CLANG_WARN_STRICT_PROTOTYPES = YES; 388 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 389 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 390 | CLANG_WARN_UNREACHABLE_CODE = YES; 391 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 392 | CODE_SIGN_IDENTITY = "iPhone Developer"; 393 | COPY_PHASE_STRIP = NO; 394 | DEBUG_INFORMATION_FORMAT = dwarf; 395 | ENABLE_STRICT_OBJC_MSGSEND = YES; 396 | ENABLE_TESTABILITY = YES; 397 | GCC_C_LANGUAGE_STANDARD = gnu11; 398 | GCC_DYNAMIC_NO_PIC = NO; 399 | GCC_NO_COMMON_BLOCKS = YES; 400 | GCC_OPTIMIZATION_LEVEL = 0; 401 | GCC_PREPROCESSOR_DEFINITIONS = ( 402 | "DEBUG=1", 403 | "$(inherited)", 404 | ); 405 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 406 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 407 | GCC_WARN_UNDECLARED_SELECTOR = YES; 408 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 409 | GCC_WARN_UNUSED_FUNCTION = YES; 410 | GCC_WARN_UNUSED_VARIABLE = YES; 411 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 412 | MTL_ENABLE_DEBUG_INFO = YES; 413 | ONLY_ACTIVE_ARCH = YES; 414 | SDKROOT = iphoneos; 415 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 416 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 417 | }; 418 | name = Debug; 419 | }; 420 | 102240BD1FE78101005AA5F8 /* Release */ = { 421 | isa = XCBuildConfiguration; 422 | buildSettings = { 423 | ALWAYS_SEARCH_USER_PATHS = NO; 424 | CLANG_ANALYZER_NONNULL = YES; 425 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 426 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 427 | CLANG_CXX_LIBRARY = "libc++"; 428 | CLANG_ENABLE_MODULES = YES; 429 | CLANG_ENABLE_OBJC_ARC = YES; 430 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 431 | CLANG_WARN_BOOL_CONVERSION = YES; 432 | CLANG_WARN_COMMA = YES; 433 | CLANG_WARN_CONSTANT_CONVERSION = YES; 434 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 435 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 436 | CLANG_WARN_EMPTY_BODY = YES; 437 | CLANG_WARN_ENUM_CONVERSION = YES; 438 | CLANG_WARN_INFINITE_RECURSION = YES; 439 | CLANG_WARN_INT_CONVERSION = YES; 440 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 441 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 442 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 443 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 444 | CLANG_WARN_STRICT_PROTOTYPES = YES; 445 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 446 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 447 | CLANG_WARN_UNREACHABLE_CODE = YES; 448 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 449 | CODE_SIGN_IDENTITY = "iPhone Developer"; 450 | COPY_PHASE_STRIP = NO; 451 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 452 | ENABLE_NS_ASSERTIONS = NO; 453 | ENABLE_STRICT_OBJC_MSGSEND = YES; 454 | GCC_C_LANGUAGE_STANDARD = gnu11; 455 | GCC_NO_COMMON_BLOCKS = YES; 456 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 457 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 458 | GCC_WARN_UNDECLARED_SELECTOR = YES; 459 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 460 | GCC_WARN_UNUSED_FUNCTION = YES; 461 | GCC_WARN_UNUSED_VARIABLE = YES; 462 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 463 | MTL_ENABLE_DEBUG_INFO = NO; 464 | SDKROOT = iphoneos; 465 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 466 | VALIDATE_PRODUCT = YES; 467 | }; 468 | name = Release; 469 | }; 470 | 102240BF1FE78101005AA5F8 /* Debug */ = { 471 | isa = XCBuildConfiguration; 472 | buildSettings = { 473 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 474 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 475 | CODE_SIGN_STYLE = Automatic; 476 | DEVELOPMENT_TEAM = BS3Y5U8GJB; 477 | INFOPLIST_FILE = RouletteWheel/Info.plist; 478 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | PRODUCT_BUNDLE_IDENTIFIER = com.app.rouletttewheel; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | PROVISIONING_PROFILE_SPECIFIER = ""; 483 | SWIFT_VERSION = 4.0; 484 | TARGETED_DEVICE_FAMILY = "1,2"; 485 | }; 486 | name = Debug; 487 | }; 488 | 102240C01FE78101005AA5F8 /* Release */ = { 489 | isa = XCBuildConfiguration; 490 | buildSettings = { 491 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 492 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 493 | CODE_SIGN_STYLE = Automatic; 494 | DEVELOPMENT_TEAM = BS3Y5U8GJB; 495 | INFOPLIST_FILE = RouletteWheel/Info.plist; 496 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 497 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 498 | PRODUCT_BUNDLE_IDENTIFIER = com.app.rouletttewheel; 499 | PRODUCT_NAME = "$(TARGET_NAME)"; 500 | PROVISIONING_PROFILE_SPECIFIER = ""; 501 | SWIFT_VERSION = 4.0; 502 | TARGETED_DEVICE_FAMILY = "1,2"; 503 | }; 504 | name = Release; 505 | }; 506 | 102240C21FE78101005AA5F8 /* Debug */ = { 507 | isa = XCBuildConfiguration; 508 | buildSettings = { 509 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 510 | BUNDLE_LOADER = "$(TEST_HOST)"; 511 | CODE_SIGN_STYLE = Automatic; 512 | INFOPLIST_FILE = RouletteWheelTests/Info.plist; 513 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 514 | PRODUCT_BUNDLE_IDENTIFIER = Codebrew.RouletteWheelTests; 515 | PRODUCT_NAME = "$(TARGET_NAME)"; 516 | SWIFT_VERSION = 4.0; 517 | TARGETED_DEVICE_FAMILY = "1,2"; 518 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RouletteWheelGame.app/RouletteWheelGame"; 519 | }; 520 | name = Debug; 521 | }; 522 | 102240C31FE78101005AA5F8 /* Release */ = { 523 | isa = XCBuildConfiguration; 524 | buildSettings = { 525 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 526 | BUNDLE_LOADER = "$(TEST_HOST)"; 527 | CODE_SIGN_STYLE = Automatic; 528 | INFOPLIST_FILE = RouletteWheelTests/Info.plist; 529 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 530 | PRODUCT_BUNDLE_IDENTIFIER = Codebrew.RouletteWheelTests; 531 | PRODUCT_NAME = "$(TARGET_NAME)"; 532 | SWIFT_VERSION = 4.0; 533 | TARGETED_DEVICE_FAMILY = "1,2"; 534 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RouletteWheelGame.app/RouletteWheelGame"; 535 | }; 536 | name = Release; 537 | }; 538 | 102240C51FE78101005AA5F8 /* Debug */ = { 539 | isa = XCBuildConfiguration; 540 | buildSettings = { 541 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 542 | CODE_SIGN_STYLE = Automatic; 543 | INFOPLIST_FILE = RouletteWheelUITests/Info.plist; 544 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 545 | PRODUCT_BUNDLE_IDENTIFIER = Codebrew.RouletteWheelUITests; 546 | PRODUCT_NAME = "$(TARGET_NAME)"; 547 | SWIFT_VERSION = 4.0; 548 | TARGETED_DEVICE_FAMILY = "1,2"; 549 | TEST_TARGET_NAME = RouletteWheel; 550 | }; 551 | name = Debug; 552 | }; 553 | 102240C61FE78101005AA5F8 /* Release */ = { 554 | isa = XCBuildConfiguration; 555 | buildSettings = { 556 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 557 | CODE_SIGN_STYLE = Automatic; 558 | INFOPLIST_FILE = RouletteWheelUITests/Info.plist; 559 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 560 | PRODUCT_BUNDLE_IDENTIFIER = Codebrew.RouletteWheelUITests; 561 | PRODUCT_NAME = "$(TARGET_NAME)"; 562 | SWIFT_VERSION = 4.0; 563 | TARGETED_DEVICE_FAMILY = "1,2"; 564 | TEST_TARGET_NAME = RouletteWheel; 565 | }; 566 | name = Release; 567 | }; 568 | /* End XCBuildConfiguration section */ 569 | 570 | /* Begin XCConfigurationList section */ 571 | 102240911FE78100005AA5F8 /* Build configuration list for PBXProject "RouletteWheelGame" */ = { 572 | isa = XCConfigurationList; 573 | buildConfigurations = ( 574 | 102240BC1FE78101005AA5F8 /* Debug */, 575 | 102240BD1FE78101005AA5F8 /* Release */, 576 | ); 577 | defaultConfigurationIsVisible = 0; 578 | defaultConfigurationName = Release; 579 | }; 580 | 102240BE1FE78101005AA5F8 /* Build configuration list for PBXNativeTarget "RouletteWheelGame" */ = { 581 | isa = XCConfigurationList; 582 | buildConfigurations = ( 583 | 102240BF1FE78101005AA5F8 /* Debug */, 584 | 102240C01FE78101005AA5F8 /* Release */, 585 | ); 586 | defaultConfigurationIsVisible = 0; 587 | defaultConfigurationName = Release; 588 | }; 589 | 102240C11FE78101005AA5F8 /* Build configuration list for PBXNativeTarget "RouletteWheelGameTests" */ = { 590 | isa = XCConfigurationList; 591 | buildConfigurations = ( 592 | 102240C21FE78101005AA5F8 /* Debug */, 593 | 102240C31FE78101005AA5F8 /* Release */, 594 | ); 595 | defaultConfigurationIsVisible = 0; 596 | defaultConfigurationName = Release; 597 | }; 598 | 102240C41FE78101005AA5F8 /* Build configuration list for PBXNativeTarget "RouletteWheelGameUITests" */ = { 599 | isa = XCConfigurationList; 600 | buildConfigurations = ( 601 | 102240C51FE78101005AA5F8 /* Debug */, 602 | 102240C61FE78101005AA5F8 /* Release */, 603 | ); 604 | defaultConfigurationIsVisible = 0; 605 | defaultConfigurationName = Release; 606 | }; 607 | /* End XCConfigurationList section */ 608 | }; 609 | rootObject = 1022408E1FE78100005AA5F8 /* Project object */; 610 | } 611 | -------------------------------------------------------------------------------- /RouletteWheelGame.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RouletteWheelGame.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RouletteWheelGame.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RouletteWheelGame.xcodeproj/project.xcworkspace/xcuserdata/shubhamdhingra.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataLocationStyle 10 | Default 11 | EnabledFullIndexStoreVisibility 12 | 13 | IssueFilterStyle 14 | ShowActiveSchemeOnly 15 | LiveSourceIssuesEnabled 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /RouletteWheelGame.xcodeproj/xcuserdata/osx.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /RouletteWheelGame.xcodeproj/xcuserdata/osx.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RouletteWheel.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | RouletteWheelGame.xcscheme 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /RouletteWheelGame.xcodeproj/xcuserdata/shubhamdhingra.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /RouletteWheelGame.xcodeproj/xcuserdata/shubhamdhingra.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RouletteWheelGame.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /RouletteWheelTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /RouletteWheelTests/RouletteWheelTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RouletteWheelTests.swift 3 | // RouletteWheelTests 4 | // 5 | // Created by OSX on 18/12/17. 6 | // Copyright © 2017 OSX. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import RouletteWheel 11 | 12 | class RouletteWheelTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /RouletteWheelUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /RouletteWheelUITests/RouletteWheelUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RouletteWheelUITests.swift 3 | // RouletteWheelUITests 4 | // 5 | // Created by OSX on 18/12/17. 6 | // Copyright © 2017 OSX. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class RouletteWheelUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------