From 1774a64c1c660a7601dd6dd03e90edc6fa0456e7 Mon Sep 17 00:00:00 2001 From: Demidengo Date: Wed, 18 Oct 2023 00:08:44 +0300 Subject: [PATCH] Mock trader model completed --- TradingView.xcodeproj/project.pbxproj | 12 +++++ TradingView/Model/TraderModel.swift | 65 +++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 TradingView/Model/TraderModel.swift diff --git a/TradingView.xcodeproj/project.pbxproj b/TradingView.xcodeproj/project.pbxproj index c8576b9..499a31f 100644 --- a/TradingView.xcodeproj/project.pbxproj +++ b/TradingView.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 92F5D9102ADF18110065CA99 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F5D90F2ADF18110065CA99 /* ViewController.swift */; }; 92F5D9152ADF18120065CA99 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92F5D9142ADF18120065CA99 /* Assets.xcassets */; }; 92F5D9182ADF18120065CA99 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 92F5D9162ADF18120065CA99 /* LaunchScreen.storyboard */; }; + 92F5D9212ADF20890065CA99 /* TraderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F5D9202ADF20890065CA99 /* TraderModel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -22,6 +23,7 @@ 92F5D9142ADF18120065CA99 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 92F5D9172ADF18120065CA99 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 92F5D9192ADF18120065CA99 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 92F5D9202ADF20890065CA99 /* TraderModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TraderModel.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -56,6 +58,7 @@ children = ( 92F5D90B2ADF18110065CA99 /* AppDelegate.swift */, 92F5D90D2ADF18110065CA99 /* SceneDelegate.swift */, + 92F5D91F2ADF204D0065CA99 /* Model */, 92F5D90F2ADF18110065CA99 /* ViewController.swift */, 92F5D9142ADF18120065CA99 /* Assets.xcassets */, 92F5D9162ADF18120065CA99 /* LaunchScreen.storyboard */, @@ -64,6 +67,14 @@ path = TradingView; sourceTree = ""; }; + 92F5D91F2ADF204D0065CA99 /* Model */ = { + isa = PBXGroup; + children = ( + 92F5D9202ADF20890065CA99 /* TraderModel.swift */, + ); + path = Model; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -137,6 +148,7 @@ 92F5D9102ADF18110065CA99 /* ViewController.swift in Sources */, 92F5D90C2ADF18110065CA99 /* AppDelegate.swift in Sources */, 92F5D90E2ADF18110065CA99 /* SceneDelegate.swift in Sources */, + 92F5D9212ADF20890065CA99 /* TraderModel.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/TradingView/Model/TraderModel.swift b/TradingView/Model/TraderModel.swift new file mode 100644 index 0000000..c1ff8a0 --- /dev/null +++ b/TradingView/Model/TraderModel.swift @@ -0,0 +1,65 @@ +// +// TraderModel.swift +// TradingView +// +// Created by Юрий Демиденко on 17.10.2023. +// + +import Foundation + +enum Country { + case usa, can, bra, jap, ger, fra, aus, ind, spa +} + +struct TraderModel { + + let name: String + let country: Country + let deposit: Int + let profit: Int + + static func makeMockModel() -> [TraderModel] { + var model = [TraderModel]() + model.append(TraderModel(name: "Oliver", + country: .usa, + deposit: 8367, + profit: 336755)) + model.append(TraderModel(name: "Jack", + country: .can, + deposit: 7489, + profit: 287190)) + model.append(TraderModel(name: "Harry", + country: .bra, + deposit: 7004, + profit: 230712)) + model.append(TraderModel(name: "Jacob", + country: .jap, + deposit: 6489, + profit: 198640)) + model.append(TraderModel(name: "Charley", + country: .ger, + deposit: 6084, + profit: 167500)) + model.append(TraderModel(name: "Thomas", + country: .bra, + deposit: 5602, + profit: 139750)) + model.append(TraderModel(name: "George", + country: .fra, + deposit: 4992, + profit: 97600)) + model.append(TraderModel(name: "Oscar", + country: .aus, + deposit: 4299, + profit: 75100)) + model.append(TraderModel(name: "James", + country: .ind, + deposit: 3015, + profit: 53760)) + model.append(TraderModel(name: "William", + country: .spa, + deposit: 1563, + profit: 25905)) + return model + } +}