From 63f83687a89618c0e8fa1b34feb3aad6dc0331d5 Mon Sep 17 00:00:00 2001 From: h_mal Date: Sun, 30 Dec 2018 13:17:05 +1000 Subject: [PATCH] Initial commit --- Extensions.swift | 41 +++++ easyCC.xcodeproj/project.pbxproj | 8 + .../xcdebugger/Breakpoints_v2.xcbkptlist | 5 + easyCC/Base.lproj/Main.storyboard | 157 +++++++++++++++++- easyCC/Dialog.xib | 16 ++ easyCC/Gradient.swift | 24 +++ easyCC/ViewController.swift | 28 +++- 7 files changed, 274 insertions(+), 5 deletions(-) create mode 100644 Extensions.swift create mode 100644 easyCC.xcodeproj/xcuserdata/h_mal.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist create mode 100644 easyCC/Dialog.xib create mode 100644 easyCC/Gradient.swift diff --git a/Extensions.swift b/Extensions.swift new file mode 100644 index 0000000..ec8efba --- /dev/null +++ b/Extensions.swift @@ -0,0 +1,41 @@ +// +// Extensions.swift +// easyCC +// +// Created by h_mal on 12/12/2018. +// Copyright © 2018 appttude. All rights reserved. +// + +import Foundation +import UIKit + +extension UIColor{ + + static let colourOne = UIColor().colorFromHex(hex: "#253031") + static let colourTwo = UIColor().colorFromHex(hex: "#315659") + static let colourThree = UIColor().colorFromHex(hex: "#2978A0") + static let colourFour = UIColor().colorFromHex(hex: "#8549ff") + static let colourFive = UIColor().colorFromHex(hex: "#C6E0FF") + + func colorFromHex( hex: String) -> UIColor{ + var hexString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased() + + if hexString.hasPrefix("#"){ + hexString.remove(at: hexString.startIndex) + } + +// if hexString.count != 6{ +// return UIColor.black +// } + + var rgbValue:UInt32 = 0 + Scanner(string: hexString).scanHexInt32(&rgbValue) + + return UIColor( + red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0, + green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0, + blue: CGFloat(rgbValue & 0x0000FF) / 255.0, + alpha: CGFloat(1.0) + ) + } +} diff --git a/easyCC.xcodeproj/project.pbxproj b/easyCC.xcodeproj/project.pbxproj index 9435894..86b8cdd 100644 --- a/easyCC.xcodeproj/project.pbxproj +++ b/easyCC.xcodeproj/project.pbxproj @@ -14,6 +14,8 @@ 6462DF4F21C0149700CB88D2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6462DF4D21C0149700CB88D2 /* LaunchScreen.storyboard */; }; 6462DF5A21C0149700CB88D2 /* easyCCTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6462DF5921C0149700CB88D2 /* easyCCTests.swift */; }; 6462DF6521C0149700CB88D2 /* easyCCUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6462DF6421C0149700CB88D2 /* easyCCUITests.swift */; }; + 6462DF7321C029D400CB88D2 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6462DF7221C029D400CB88D2 /* Extensions.swift */; }; + 6462DF7521C02F6000CB88D2 /* Gradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6462DF7421C02F6000CB88D2 /* Gradient.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -47,6 +49,8 @@ 6462DF6021C0149700CB88D2 /* easyCCUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = easyCCUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 6462DF6421C0149700CB88D2 /* easyCCUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = easyCCUITests.swift; sourceTree = ""; }; 6462DF6621C0149700CB88D2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6462DF7221C029D400CB88D2 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = ../Extensions.swift; sourceTree = ""; }; + 6462DF7421C02F6000CB88D2 /* Gradient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Gradient.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -97,6 +101,8 @@ 6462DF4321C0149700CB88D2 /* easyCC */ = { isa = PBXGroup; children = ( + 6462DF7221C029D400CB88D2 /* Extensions.swift */, + 6462DF7421C02F6000CB88D2 /* Gradient.swift */, 6462DF4421C0149700CB88D2 /* AppDelegate.swift */, 6462DF4621C0149700CB88D2 /* ViewController.swift */, 6462DF4821C0149700CB88D2 /* Main.storyboard */, @@ -260,7 +266,9 @@ buildActionMask = 2147483647; files = ( 6462DF4721C0149700CB88D2 /* ViewController.swift in Sources */, + 6462DF7321C029D400CB88D2 /* Extensions.swift in Sources */, 6462DF4521C0149700CB88D2 /* AppDelegate.swift in Sources */, + 6462DF7521C02F6000CB88D2 /* Gradient.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/easyCC.xcodeproj/xcuserdata/h_mal.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/easyCC.xcodeproj/xcuserdata/h_mal.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/easyCC.xcodeproj/xcuserdata/h_mal.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/easyCC/Base.lproj/Main.storyboard b/easyCC/Base.lproj/Main.storyboard index 273375f..45026bd 100644 --- a/easyCC/Base.lproj/Main.storyboard +++ b/easyCC/Base.lproj/Main.storyboard @@ -1,14 +1,19 @@ - - + + + + + - + + + - + @@ -16,11 +21,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/easyCC/Dialog.xib b/easyCC/Dialog.xib new file mode 100644 index 0000000..1bd722e --- /dev/null +++ b/easyCC/Dialog.xib @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/easyCC/Gradient.swift b/easyCC/Gradient.swift new file mode 100644 index 0000000..f39651e --- /dev/null +++ b/easyCC/Gradient.swift @@ -0,0 +1,24 @@ +// +// Gradient.swift +// easyCC +// +// Created by h_mal on 12/12/2018. +// Copyright © 2018 appttude. All rights reserved. +// + +import Foundation +import UIKit + +extension UIView{ + + func setGradientBackground(colourOne: UIColor, colourTwo: UIColor){ + + let gradientLater = CAGradientLayer() + gradientLater.frame = bounds + gradientLater.colors = [colourOne.cgColor, colourTwo.cgColor] + gradientLater.startPoint = CGPoint(x: 1.0, y: 1.0) + gradientLater.endPoint = CGPoint(x: 0.0, y: 0.0) + + layer.insertSublayer(gradientLater, at: 0) + } +} diff --git a/easyCC/ViewController.swift b/easyCC/ViewController.swift index ddbc02c..e19aa51 100644 --- a/easyCC/ViewController.swift +++ b/easyCC/ViewController.swift @@ -9,17 +9,43 @@ import UIKit class ViewController: UIViewController { + + @IBOutlet weak var CurrencyOneButton: UIButton! + + @IBOutlet weak var CurrencyTwoButton: UIButton! + + @IBOutlet weak var CurrencyOneEditText: UITextField! + + @IBOutlet weak var CurrencyTwoEditText: UITextField! + + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. + + view.setGradientBackground(colourOne: UIColor.colourThree, colourTwo: UIColor.colourTwo) + + CurrencyOneButton.layer.cornerRadius = 22 + CurrencyTwoButton.layer.cornerRadius = 22 + CurrencyOneEditText.layer.cornerRadius = 22 + CurrencyTwoEditText.layer.cornerRadius = 22 + + CurrencyOneButton.backgroundColor = UIColor.colourThree + CurrencyTwoButton.backgroundColor = UIColor.colourThree + CurrencyOneEditText.backgroundColor = UIColor.colourTwo + CurrencyTwoEditText.backgroundColor = UIColor.colourTwo + } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } - + + + } +