Skip to content

Commit

Permalink
Merge pull request #20 from mac-gallagher/develop
Browse files Browse the repository at this point in the history
Add storyboard support
  • Loading branch information
mac-gallagher committed Apr 28, 2019
2 parents 770685e + 2820f59 commit df5dbd3
Show file tree
Hide file tree
Showing 26 changed files with 815 additions and 125 deletions.
3 changes: 2 additions & 1 deletion Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
window?.rootViewController = ViewController()
let navigationController = UINavigationController(rootViewController: DemoViewController())
window?.rootViewController = navigationController
return true
}
}
53 changes: 53 additions & 0 deletions Example/DemoViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// DemoViewController.swift
// MultiProgressViewExample
//
// Created by Mac Gallagher on 4/26/19.
// Copyright © 2019 Mac Gallagher. All rights reserved.
//

import UIKit

class DemoViewController: UITableViewController {

override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "Demo"
tableView.tableFooterView = UIView()
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell()
cell.textLabel?.font = UIFont.systemFont(ofSize: 14)
switch indexPath.row {
case 0:
cell.textLabel?.text = "Single Progress View (Programmatic)"
case 1:
cell.textLabel?.text = "Multiple Progress Views (Storyboard)"
default:
break
}
return cell
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch indexPath.row {
case 0:
navigationController?.pushViewController(StorageExampleViewController(), animated: true)
case 1:
let storyboard = UIStoryboard(name: "LanguageExample", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "LanguageExampleViewController")
navigationController?.pushViewController(viewController, animated: true)
default:
break
}
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 50
}
}
35 changes: 27 additions & 8 deletions Example/Extensions/UIColor+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,32 @@ extension UIColor {
return UIColor(red: red/255, green: green/255, blue: blue/255, alpha: 1)
}

static let progressRed = UIColor.rgb(red: 251, green: 16, blue: 68)
static let progressGreen = UIColor.rgb(red: 67, green: 213, blue: 82)
static let progressPurple = UIColor.rgb(red: 70, green: 58, blue: 205)
static let progressYellow = UIColor.rgb(red: 252, green: 196, blue: 9)
static let progressBlue = UIColor.rgb(red: 10, green: 96, blue: 253)
static let progressOrange = UIColor.rgb(red: 251, green: 128, blue: 7)
static let progressGray = UIColor.rgb(red: 188, green: 186, blue: 194)
struct StorageExample {
static let progressRed = UIColor.rgb(red: 251, green: 16, blue: 68)
static let progressGreen = UIColor.rgb(red: 67, green: 213, blue: 82)
static let progressPurple = UIColor.rgb(red: 70, green: 58, blue: 205)
static let progressYellow = UIColor.rgb(red: 252, green: 196, blue: 9)
static let progressBlue = UIColor.rgb(red: 10, green: 96, blue: 253)
static let progressOrange = UIColor.rgb(red: 251, green: 128, blue: 7)
static let progressGray = UIColor.rgb(red: 188, green: 186, blue: 194)
static let progressBackground = UIColor.rgb(red: 224, green: 224, blue: 224)

static let backgroundGray = UIColor.rgb(red: 235, green: 235, blue: 242)
static let borderColor = UIColor.rgb(red: 189, green: 189, blue: 189)
}

static let progressBackground = UIColor.rgb(red: 224, green: 224, blue: 224)
struct LanguageExample {
static let progressBlueDark = UIColor.rgb(red: 45, green: 94, blue: 146)
static let progressBlueLight = UIColor.rgb(red: 54, green: 117, blue: 190)
static let progressGreenDark = UIColor.rgb(red: 65, green: 136, blue: 61)
static let progressGreenLight = UIColor.rgb(red: 77, green: 173, blue: 74)
static let progressCyanDark = UIColor.rgb(red: 63, green: 141, blue: 167)
static let progressCyanLight = UIColor.rgb(red: 79, green: 177, blue: 216)
static let progressYellowDark = UIColor.rgb(red: 182, green: 125, blue: 51)
static let progressYellowLight = UIColor.rgb(red: 233, green: 158, blue: 60)
static let progressRedDark = UIColor.rgb(red: 160, green: 51, blue: 52)
static let progressRedLight = UIColor.rgb(red: 204, green: 61, blue: 62)

static let borderColor = UIColor.rgb(red: 189, green: 189, blue: 189)
}
}
64 changes: 64 additions & 0 deletions Example/LanguageExample/CodingLanguage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// CodingLanguage.swift
// MultiProgressViewExample
//
// Created by Mac Gallagher on 4/26/19.
// Copyright © 2019 Mac Gallagher. All rights reserved.
//

import UIKit

enum CodingLanguage: Int {
case none, html, net, java, javascript, css

var description: String {
switch self {
case .none:
return "Language"
case .html:
return "HTML/HTML5"
case .net:
return "ASP.Net"
case .java:
return "Java"
case .javascript:
return "JavaScript/jQuery"
case .css:
return "CSS/CSS3"
}
}

var darkColor: UIColor {
switch self {
case .none:
return .black
case .html:
return UIColor.LanguageExample.progressBlueDark
case .net:
return UIColor.LanguageExample.progressGreenDark
case .java:
return UIColor.LanguageExample.progressCyanDark
case .javascript:
return UIColor.LanguageExample.progressYellowDark
case .css:
return UIColor.LanguageExample.progressRedDark
}
}

var lightColor: UIColor {
switch self {
case .none:
return .black
case .html:
return UIColor.LanguageExample.progressBlueLight
case .net:
return UIColor.LanguageExample.progressGreenLight
case .java:
return UIColor.LanguageExample.progressCyanLight
case .javascript:
return UIColor.LanguageExample.progressYellowLight
case .css:
return UIColor.LanguageExample.progressRedLight
}
}
}
Loading

0 comments on commit df5dbd3

Please sign in to comment.