Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 2 more currency #7

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
27 changes: 20 additions & 7 deletions ByteCoin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
43A61E9C2B73C14800CB3913 /* CoinData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A61E9B2B73C14800CB3913 /* CoinData.swift */; };
43A61E9E2B73CB1100CB3913 /* CoinModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A61E9D2B73CB1100CB3913 /* CoinModel.swift */; };
ADA8AC092329367100626376 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADA8AC082329367100626376 /* AppDelegate.swift */; };
ADA8AC0B2329367100626376 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADA8AC0A2329367100626376 /* SceneDelegate.swift */; };
ADA8AC0D2329367100626376 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADA8AC0C2329367100626376 /* ViewController.swift */; };
Expand All @@ -17,6 +19,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
43A61E9B2B73C14800CB3913 /* CoinData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoinData.swift; sourceTree = "<group>"; };
43A61E9D2B73CB1100CB3913 /* CoinModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoinModel.swift; sourceTree = "<group>"; };
ADA8AC052329367100626376 /* ByteCoin.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ByteCoin.app; sourceTree = BUILT_PRODUCTS_DIR; };
ADA8AC082329367100626376 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
ADA8AC0A2329367100626376 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -90,6 +94,8 @@
isa = PBXGroup;
children = (
ADA8AC1F2329398300626376 /* CoinManager.swift */,
43A61E9B2B73C14800CB3913 /* CoinData.swift */,
43A61E9D2B73CB1100CB3913 /* CoinModel.swift */,
);
path = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -120,9 +126,10 @@
ADA8ABFD2329367100626376 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1100;
LastUpgradeCheck = 1100;
ORGANIZATIONNAME = "The App Brewery";
LastUpgradeCheck = 1520;
ORGANIZATIONNAME = ShriGanesh;
TargetAttributes = {
ADA8AC042329367100626376 = {
CreatedOnToolsVersion = 11.0;
Expand Down Expand Up @@ -167,7 +174,9 @@
files = (
ADA8AC202329398300626376 /* CoinManager.swift in Sources */,
ADA8AC0D2329367100626376 /* ViewController.swift in Sources */,
43A61E9C2B73C14800CB3913 /* CoinData.swift in Sources */,
ADA8AC092329367100626376 /* AppDelegate.swift in Sources */,
43A61E9E2B73CB1100CB3913 /* CoinModel.swift in Sources */,
ADA8AC0B2329367100626376 /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -220,6 +229,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -230,6 +240,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -280,6 +291,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -290,6 +302,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand All @@ -313,13 +326,13 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 3ECFYJZ64T;
DEVELOPMENT_TEAM = 9T4F842V7Q;
INFOPLIST_FILE = ByteCoin/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = co.appbrewery.ByteCoin;
PRODUCT_BUNDLE_IDENTIFIER = co.shreeganeshpurohit;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -331,13 +344,13 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 3ECFYJZ64T;
DEVELOPMENT_TEAM = 9T4F842V7Q;
INFOPLIST_FILE = ByteCoin/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = co.appbrewery.ByteCoin;
PRODUCT_BUNDLE_IDENTIFIER = co.shreeganeshpurohit;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>ByteCoin.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
8 changes: 1 addition & 7 deletions ByteCoin/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
//
// AppDelegate.swift
// ByteCoin
//
// Created by Angela Yu on 11/09/2019.
// Copyright © 2019 The App Brewery. All rights reserved.
//


import UIKit

Expand Down
Binary file added ByteCoin/Assets.xcassets/BTC.imageset/BTC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions ByteCoin/Assets.xcassets/BTC.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "BTC.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 3 additions & 3 deletions ByteCoin/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
23 changes: 23 additions & 0 deletions ByteCoin/Assets.xcassets/ETH.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ETH.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file added ByteCoin/Assets.xcassets/ETH.imageset/ETH.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions ByteCoin/Assets.xcassets/SOLANA.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "SOLANA.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
106 changes: 97 additions & 9 deletions ByteCoin/Controller/ViewController.swift
Original file line number Diff line number Diff line change
@@ -1,20 +1,108 @@
//
// ViewController.swift
// ByteCoin
//
// Created by Angela Yu on 11/09/2019.
// Copyright © 2019 The App Brewery. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
class ViewController: UIViewController,UIPickerViewDataSource,UIPickerViewDelegate,CoinManagerApiJson {





//BTC

@IBOutlet weak var btcPriceField: UILabel!

@IBOutlet weak var btccurrencyLabel: UILabel!

@IBOutlet weak var pickerElement: UIPickerView!

//ETC


@IBOutlet weak var etcPriceLabel: UILabel!

@IBOutlet weak var ethCurrencyLabel: UILabel!


//Solana


@IBOutlet weak var solPriceLabel: UILabel!


@IBOutlet weak var solCurrencyLabel: UILabel!


var coinManager = CoinManager()

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
pickerElement.dataSource = self
pickerElement.delegate = self
coinManager.delegate = self

}


func updatePriceETH(_ price: String, _ currentcurrency: String) {
DispatchQueue.main.async {
self.etcPriceLabel.text = price
self.ethCurrencyLabel.text = currentcurrency

}
}

func updatePriceSOL(_ price: String, _ currentcurrency: String) {
DispatchQueue.main.async {
self.solPriceLabel.text = price
self.solCurrencyLabel.text = currentcurrency

}
}

func updatePrice(_ price: String, _ currentcurrency: String) {
DispatchQueue.main.async {
self.btcPriceField.text = price
self.btccurrencyLabel.text = currentcurrency
}
}

func didFailedWithError(error: Error) {
print(error)
}




func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
coinManager.getCoinPrice(for: coinManager.currencyArray[row],coin:"BTC/")
coinManager.getCoinPrice(for: coinManager.currencyArray[row],coin:"ETH/")
coinManager.getCoinPrice(for: coinManager.currencyArray[row],coin:"SOL/")


}

func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}

func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return coinManager.currencyArray.count
}

func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return coinManager.currencyArray[row]

}






}






9 changes: 9 additions & 0 deletions ByteCoin/Model/CoinData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Foundation

struct CoinData: Decodable{
let rate : Double




}
Loading