@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "Trophy.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 7.0 KiB |
@ -1,22 +0,0 @@
|
|||||||
//
|
|
||||||
// User.swift
|
|
||||||
// AllIn
|
|
||||||
//
|
|
||||||
// Created by Emre on 11/10/2023.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
class User {
|
|
||||||
|
|
||||||
public var username: String
|
|
||||||
public var email: String
|
|
||||||
public var nbCoins: Int
|
|
||||||
|
|
||||||
public init(username: String, email: String, nbCoins: Int)
|
|
||||||
{
|
|
||||||
self.username = username
|
|
||||||
self.email = email
|
|
||||||
self.nbCoins = nbCoins
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// BetViewModel.swift
|
||||||
|
// AllIn
|
||||||
|
//
|
||||||
|
// Created by Emre on 30/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import DependencyInjection
|
||||||
|
import ViewModel
|
||||||
|
|
||||||
|
class BetViewModel: ObservableObject {
|
||||||
|
|
||||||
|
@Inject var manager: ManagerVM
|
||||||
|
|
||||||
|
init() {
|
||||||
|
getItems()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getItems() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteItem(indexSet: IndexSet) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func moveltem(from: IndexSet, to: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func addItem(title: String) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
//
|
||||||
|
// CreationBetViewModel.swift
|
||||||
|
// AllIn
|
||||||
|
//
|
||||||
|
// Created by Emre on 30/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import SwiftUI
|
||||||
|
import DependencyInjection
|
||||||
|
import ViewModel
|
||||||
|
|
||||||
|
class CreationBetViewModel: ObservableObject {
|
||||||
|
|
||||||
|
@Inject var manager: ManagerVM
|
||||||
|
@Published var theme: String = ""
|
||||||
|
@Published var description: String = ""
|
||||||
|
@Published var isPublic = true
|
||||||
|
@Published var endRegisterDate = Date()
|
||||||
|
@Published var endBetDate = Date()
|
||||||
|
|
||||||
|
@Published var themeFieldError: String?
|
||||||
|
@Published var descriptionFieldError: String?
|
||||||
|
@Published var endRegisterDateFieldError: String?
|
||||||
|
@Published var endBetDateFieldError: String?
|
||||||
|
|
||||||
|
func create() {
|
||||||
|
|
||||||
|
guard checkAndSetError(forTheme: true, forDescription: true, forEndRegisterDate: true, forEndBetDate: true) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resetAllFieldErrors()
|
||||||
|
|
||||||
|
if let user = AppStateContainer.shared.user {
|
||||||
|
manager.addBet(theme: theme, description: description, endRegister: endRegisterDate, endBet: endBetDate, isPublic: isPublic, creator: user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkAndSetError(forTheme checkTheme: Bool, forDescription checkDescription: Bool, forEndRegisterDate checkEndRegisterDate: Bool, forEndBetDate checkEndBetDate: Bool) -> Bool {
|
||||||
|
|
||||||
|
var newThemeFieldError: String?
|
||||||
|
var newDescriptionFieldError: String?
|
||||||
|
var newEndRegisterDateFieldError: String?
|
||||||
|
var newEndBetDateFieldError: String?
|
||||||
|
|
||||||
|
var hasError = false
|
||||||
|
|
||||||
|
// Theme
|
||||||
|
if checkTheme, theme.isEmpty {
|
||||||
|
newThemeFieldError = "Veuillez saisir le thème."
|
||||||
|
hasError = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Description
|
||||||
|
if checkDescription, description.isEmpty {
|
||||||
|
newDescriptionFieldError = "Veuillez saisir la description."
|
||||||
|
hasError = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// End Register Date
|
||||||
|
if checkEndRegisterDate, endRegisterDate < Date() {
|
||||||
|
newEndRegisterDateFieldError = "La date de fin des inscriptions doit être ultérieure à la date actuelle."
|
||||||
|
hasError = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// End Bet Date
|
||||||
|
if checkEndBetDate, endBetDate < endRegisterDate {
|
||||||
|
newEndBetDateFieldError = "La date de fin des paris doit être ultérieure à la date de fin des inscriptions."
|
||||||
|
hasError = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if !hasError {
|
||||||
|
// No error
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
withAnimation {
|
||||||
|
themeFieldError = newThemeFieldError
|
||||||
|
descriptionFieldError = newDescriptionFieldError
|
||||||
|
endRegisterDateFieldError = newEndRegisterDateFieldError
|
||||||
|
endBetDateFieldError = newEndBetDateFieldError
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func resetAllFieldErrors() {
|
||||||
|
withAnimation {
|
||||||
|
themeFieldError = nil
|
||||||
|
descriptionFieldError = nil
|
||||||
|
endRegisterDateFieldError = nil
|
||||||
|
endBetDateFieldError = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// FriendsViewModel.swift
|
||||||
|
// AllIn
|
||||||
|
//
|
||||||
|
// Created by Emre on 30/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import DependencyInjection
|
||||||
|
import ViewModel
|
||||||
|
|
||||||
|
class FriendsViewModel: ObservableObject {
|
||||||
|
|
||||||
|
@Inject var manager: ManagerVM
|
||||||
|
|
||||||
|
init() {
|
||||||
|
getItems()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getItems ( ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteItem(indexSet: IndexSet) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func moveltem(from: IndexSet, to: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func addItem(title: String) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// RankingViewModel.swift
|
||||||
|
// AllIn
|
||||||
|
//
|
||||||
|
// Created by Emre on 30/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import DependencyInjection
|
||||||
|
import ViewModel
|
||||||
|
|
||||||
|
class RankingViewModel: ObservableObject {
|
||||||
|
|
||||||
|
@Inject var manager: ManagerVM
|
||||||
|
|
||||||
|
init() {
|
||||||
|
getItems()
|
||||||
|
}
|
||||||
|
|
||||||
|
func getItems ( ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteItem(indexSet: IndexSet) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func moveltem(from: IndexSet, to: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func addItem(title: String) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
// swift-tools-version: 5.8
|
||||||
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "Api",
|
||||||
|
products: [
|
||||||
|
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||||
|
.library(
|
||||||
|
name: "Api",
|
||||||
|
targets: ["Api"]),
|
||||||
|
],
|
||||||
|
dependencies: [
|
||||||
|
// Dependencies declare other packages that this package depends on.
|
||||||
|
// .package(url: /* package url */, from: "1.0.0"),
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||||
|
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
||||||
|
.target(
|
||||||
|
name: "Api",
|
||||||
|
dependencies: []),
|
||||||
|
]
|
||||||
|
)
|
@ -0,0 +1,3 @@
|
|||||||
|
# Api
|
||||||
|
|
||||||
|
A description of this package.
|
@ -0,0 +1,52 @@
|
|||||||
|
//
|
||||||
|
// UserApiManager.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 31/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Model
|
||||||
|
|
||||||
|
let allInApi = "https://codefirst.iut.uca.fr/containers/AllDev-api"
|
||||||
|
|
||||||
|
public struct UserApiManager: UserDataManager {
|
||||||
|
|
||||||
|
public init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getBets(withIndex index: Int, withCount count: Int) -> [Bet] {
|
||||||
|
fatalError("Not implemented yet")
|
||||||
|
}
|
||||||
|
|
||||||
|
public func addBet(bet: Bet) {
|
||||||
|
|
||||||
|
let url = URL(string: allInApi + "bets/add")!
|
||||||
|
var request = URLRequest(url: url)
|
||||||
|
request.httpMethod = "POST"
|
||||||
|
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
||||||
|
|
||||||
|
let dateFormatter = DateFormatter()
|
||||||
|
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
||||||
|
|
||||||
|
let json = [
|
||||||
|
"theme": bet.theme,
|
||||||
|
"sentenceBet": bet.phrase,
|
||||||
|
"endRegistration": dateFormatter.string(from: bet.endRegisterDate),
|
||||||
|
"endBet": dateFormatter.string(from: bet.endBetDate),
|
||||||
|
"isPrivate": String(bet.isPublic),
|
||||||
|
"response": "",
|
||||||
|
"createdBy": ""
|
||||||
|
]
|
||||||
|
|
||||||
|
if let jsonData = try? JSONSerialization.data(withJSONObject: json, options: []){
|
||||||
|
URLSession.shared.uploadTask(with: request, from: jsonData) { data, response, error in
|
||||||
|
|
||||||
|
}.resume()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getFriends() -> [User] {
|
||||||
|
fatalError("Not implemented yet")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,486 @@
|
|||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 56;
|
||||||
|
objects = {
|
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */
|
||||||
|
ECB3572C2B3CA37800045D41 /* DependencyInjection.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB3572B2B3CA37800045D41 /* DependencyInjection.swift */; };
|
||||||
|
ECEE18B82B3C9CF400C95E8A /* DependencyInjection.docc in Sources */ = {isa = PBXBuildFile; fileRef = ECEE18B72B3C9CF400C95E8A /* DependencyInjection.docc */; };
|
||||||
|
ECEE18BE2B3C9CF400C95E8A /* DependencyInjection.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ECEE18B32B3C9CF400C95E8A /* DependencyInjection.framework */; };
|
||||||
|
ECEE18C32B3C9CF400C95E8A /* DependencyInjectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECEE18C22B3C9CF400C95E8A /* DependencyInjectionTests.swift */; };
|
||||||
|
ECEE18C42B3C9CF400C95E8A /* DependencyInjection.h in Headers */ = {isa = PBXBuildFile; fileRef = ECEE18B62B3C9CF400C95E8A /* DependencyInjection.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
ECEE18BF2B3C9CF400C95E8A /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = ECEE18AA2B3C9CF400C95E8A /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = ECEE18B22B3C9CF400C95E8A;
|
||||||
|
remoteInfo = DependencyInjection;
|
||||||
|
};
|
||||||
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
ECB3572B2B3CA37800045D41 /* DependencyInjection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DependencyInjection.swift; sourceTree = "<group>"; };
|
||||||
|
ECEE18B32B3C9CF400C95E8A /* DependencyInjection.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DependencyInjection.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
ECEE18B62B3C9CF400C95E8A /* DependencyInjection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DependencyInjection.h; sourceTree = "<group>"; };
|
||||||
|
ECEE18B72B3C9CF400C95E8A /* DependencyInjection.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = DependencyInjection.docc; sourceTree = "<group>"; };
|
||||||
|
ECEE18BD2B3C9CF400C95E8A /* DependencyInjectionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DependencyInjectionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
ECEE18C22B3C9CF400C95E8A /* DependencyInjectionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DependencyInjectionTests.swift; sourceTree = "<group>"; };
|
||||||
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
ECEE18B02B3C9CF400C95E8A /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
ECEE18BA2B3C9CF400C95E8A /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
ECEE18BE2B3C9CF400C95E8A /* DependencyInjection.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXGroup section */
|
||||||
|
ECEE18A92B3C9CF400C95E8A = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
ECEE18B52B3C9CF400C95E8A /* DependencyInjection */,
|
||||||
|
ECEE18C12B3C9CF400C95E8A /* DependencyInjectionTests */,
|
||||||
|
ECEE18B42B3C9CF400C95E8A /* Products */,
|
||||||
|
);
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
ECEE18B42B3C9CF400C95E8A /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
ECEE18B32B3C9CF400C95E8A /* DependencyInjection.framework */,
|
||||||
|
ECEE18BD2B3C9CF400C95E8A /* DependencyInjectionTests.xctest */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
ECEE18B52B3C9CF400C95E8A /* DependencyInjection */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
ECEE18B62B3C9CF400C95E8A /* DependencyInjection.h */,
|
||||||
|
ECEE18B72B3C9CF400C95E8A /* DependencyInjection.docc */,
|
||||||
|
ECB3572B2B3CA37800045D41 /* DependencyInjection.swift */,
|
||||||
|
);
|
||||||
|
path = DependencyInjection;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
ECEE18C12B3C9CF400C95E8A /* DependencyInjectionTests */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
ECEE18C22B3C9CF400C95E8A /* DependencyInjectionTests.swift */,
|
||||||
|
);
|
||||||
|
path = DependencyInjectionTests;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXGroup section */
|
||||||
|
|
||||||
|
/* Begin PBXHeadersBuildPhase section */
|
||||||
|
ECEE18AE2B3C9CF400C95E8A /* Headers */ = {
|
||||||
|
isa = PBXHeadersBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
ECEE18C42B3C9CF400C95E8A /* DependencyInjection.h in Headers */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXHeadersBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */
|
||||||
|
ECEE18B22B3C9CF400C95E8A /* DependencyInjection */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = ECEE18C72B3C9CF400C95E8A /* Build configuration list for PBXNativeTarget "DependencyInjection" */;
|
||||||
|
buildPhases = (
|
||||||
|
ECEE18AE2B3C9CF400C95E8A /* Headers */,
|
||||||
|
ECEE18AF2B3C9CF400C95E8A /* Sources */,
|
||||||
|
ECEE18B02B3C9CF400C95E8A /* Frameworks */,
|
||||||
|
ECEE18B12B3C9CF400C95E8A /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = DependencyInjection;
|
||||||
|
productName = DependencyInjection;
|
||||||
|
productReference = ECEE18B32B3C9CF400C95E8A /* DependencyInjection.framework */;
|
||||||
|
productType = "com.apple.product-type.framework";
|
||||||
|
};
|
||||||
|
ECEE18BC2B3C9CF400C95E8A /* DependencyInjectionTests */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = ECEE18CA2B3C9CF400C95E8A /* Build configuration list for PBXNativeTarget "DependencyInjectionTests" */;
|
||||||
|
buildPhases = (
|
||||||
|
ECEE18B92B3C9CF400C95E8A /* Sources */,
|
||||||
|
ECEE18BA2B3C9CF400C95E8A /* Frameworks */,
|
||||||
|
ECEE18BB2B3C9CF400C95E8A /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
ECEE18C02B3C9CF400C95E8A /* PBXTargetDependency */,
|
||||||
|
);
|
||||||
|
name = DependencyInjectionTests;
|
||||||
|
productName = DependencyInjectionTests;
|
||||||
|
productReference = ECEE18BD2B3C9CF400C95E8A /* DependencyInjectionTests.xctest */;
|
||||||
|
productType = "com.apple.product-type.bundle.unit-test";
|
||||||
|
};
|
||||||
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
|
/* Begin PBXProject section */
|
||||||
|
ECEE18AA2B3C9CF400C95E8A /* Project object */ = {
|
||||||
|
isa = PBXProject;
|
||||||
|
attributes = {
|
||||||
|
BuildIndependentTargetsInParallel = 1;
|
||||||
|
LastSwiftUpdateCheck = 1430;
|
||||||
|
LastUpgradeCheck = 1430;
|
||||||
|
TargetAttributes = {
|
||||||
|
ECEE18B22B3C9CF400C95E8A = {
|
||||||
|
CreatedOnToolsVersion = 14.3.1;
|
||||||
|
};
|
||||||
|
ECEE18BC2B3C9CF400C95E8A = {
|
||||||
|
CreatedOnToolsVersion = 14.3.1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
buildConfigurationList = ECEE18AD2B3C9CF400C95E8A /* Build configuration list for PBXProject "DependencyInjection" */;
|
||||||
|
compatibilityVersion = "Xcode 14.0";
|
||||||
|
developmentRegion = en;
|
||||||
|
hasScannedForEncodings = 0;
|
||||||
|
knownRegions = (
|
||||||
|
en,
|
||||||
|
Base,
|
||||||
|
);
|
||||||
|
mainGroup = ECEE18A92B3C9CF400C95E8A;
|
||||||
|
productRefGroup = ECEE18B42B3C9CF400C95E8A /* Products */;
|
||||||
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
|
targets = (
|
||||||
|
ECEE18B22B3C9CF400C95E8A /* DependencyInjection */,
|
||||||
|
ECEE18BC2B3C9CF400C95E8A /* DependencyInjectionTests */,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/* End PBXProject section */
|
||||||
|
|
||||||
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
ECEE18B12B3C9CF400C95E8A /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
ECEE18BB2B3C9CF400C95E8A /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
ECEE18AF2B3C9CF400C95E8A /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
ECB3572C2B3CA37800045D41 /* DependencyInjection.swift in Sources */,
|
||||||
|
ECEE18B82B3C9CF400C95E8A /* DependencyInjection.docc in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
ECEE18B92B3C9CF400C95E8A /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
ECEE18C32B3C9CF400C95E8A /* DependencyInjectionTests.swift in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXTargetDependency section */
|
||||||
|
ECEE18C02B3C9CF400C95E8A /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = ECEE18B22B3C9CF400C95E8A /* DependencyInjection */;
|
||||||
|
targetProxy = ECEE18BF2B3C9CF400C95E8A /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */
|
||||||
|
ECEE18C52B3C9CF400C95E8A /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
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;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_TESTABILITY = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
VERSION_INFO_PREFIX = "";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
ECEE18C62B3C9CF400C95E8A /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
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;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
VERSION_INFO_PREFIX = "";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
ECEE18C82B3C9CF400C95E8A /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
ENABLE_MODULE_VERIFIER = YES;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@loader_path/Frameworks",
|
||||||
|
);
|
||||||
|
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
|
||||||
|
"@executable_path/../Frameworks",
|
||||||
|
"@loader_path/Frameworks",
|
||||||
|
);
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 13.3;
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
|
||||||
|
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20";
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.alldev.DependencyInjection;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
|
SDKROOT = auto;
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
ECEE18C92B3C9CF400C95E8A /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
ENABLE_MODULE_VERIFIER = YES;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@loader_path/Frameworks",
|
||||||
|
);
|
||||||
|
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
|
||||||
|
"@executable_path/../Frameworks",
|
||||||
|
"@loader_path/Frameworks",
|
||||||
|
);
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 13.3;
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
|
||||||
|
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20";
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.alldev.DependencyInjection;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
|
SDKROOT = auto;
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
ECEE18CB2B3C9CF400C95E8A /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 13.3;
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.alldev.DependencyInjectionTests;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SDKROOT = auto;
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
ECEE18CC2B3C9CF400C95E8A /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 13.3;
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.alldev.DependencyInjectionTests;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SDKROOT = auto;
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */
|
||||||
|
ECEE18AD2B3C9CF400C95E8A /* Build configuration list for PBXProject "DependencyInjection" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
ECEE18C52B3C9CF400C95E8A /* Debug */,
|
||||||
|
ECEE18C62B3C9CF400C95E8A /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
ECEE18C72B3C9CF400C95E8A /* Build configuration list for PBXNativeTarget "DependencyInjection" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
ECEE18C82B3C9CF400C95E8A /* Debug */,
|
||||||
|
ECEE18C92B3C9CF400C95E8A /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
ECEE18CA2B3C9CF400C95E8A /* Build configuration list for PBXNativeTarget "DependencyInjectionTests" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
ECEE18CB2B3C9CF400C95E8A /* Debug */,
|
||||||
|
ECEE18CC2B3C9CF400C95E8A /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
/* End XCConfigurationList section */
|
||||||
|
};
|
||||||
|
rootObject = ECEE18AA2B3C9CF400C95E8A /* Project object */;
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Workspace
|
||||||
|
version = "1.0">
|
||||||
|
<FileRef
|
||||||
|
location = "self:">
|
||||||
|
</FileRef>
|
||||||
|
</Workspace>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?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>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -0,0 +1,13 @@
|
|||||||
|
# ``DependencyInjection``
|
||||||
|
|
||||||
|
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@-->
|
||||||
|
|
||||||
|
## Topics
|
||||||
|
|
||||||
|
### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@-->
|
||||||
|
|
||||||
|
- <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@-->
|
@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// DependencyInjection.h
|
||||||
|
// DependencyInjection
|
||||||
|
//
|
||||||
|
// Created by Emre on 27/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
//! Project version number for DependencyInjection.
|
||||||
|
FOUNDATION_EXPORT double DependencyInjectionVersionNumber;
|
||||||
|
|
||||||
|
//! Project version string for DependencyInjection.
|
||||||
|
FOUNDATION_EXPORT const unsigned char DependencyInjectionVersionString[];
|
||||||
|
|
||||||
|
// In this header, you should import all the public headers of your framework using statements like #import <DependencyInjection/PublicHeader.h>
|
||||||
|
|
||||||
|
|
@ -1,38 +1,38 @@
|
|||||||
//
|
//
|
||||||
// DependancyInjection.swift
|
// DependencyInjection.swift
|
||||||
// AllIn
|
// DependencyInjection
|
||||||
//
|
//
|
||||||
// Created by Emre on 20/10/2023.
|
// Created by Emre on 27/12/2023.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class DependencyInjection {
|
public class DependencyInjection {
|
||||||
static var shared = DependencyInjection()
|
public static var shared = DependencyInjection()
|
||||||
private var singletons = [String: Any]()
|
private var singletons = [String: Any]()
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
func addSingleton<T>(_ type: T.Type, _ instance: T) -> DependencyInjection {
|
public func addSingleton<T>(_ type: T.Type, _ instance: T) -> DependencyInjection {
|
||||||
let key = String(describing: T.self)
|
let key = String(describing: T.self)
|
||||||
singletons[key] = instance
|
singletons[key] = instance
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolve<T>(_ type: T.Type) -> T? {
|
public func resolve<T>(_ type: T.Type) -> T? {
|
||||||
let key = String(describing: T.self)
|
let key = String(describing: T.self)
|
||||||
return singletons[key] as? T
|
return singletons[key] as? T
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@propertyWrapper
|
@propertyWrapper
|
||||||
struct Inject<T> {
|
public struct Inject<T> {
|
||||||
private var value: T?
|
private var value: T?
|
||||||
|
|
||||||
init() {
|
public init() {
|
||||||
self.value = DependencyInjection.shared.resolve(T.self)
|
self.value = DependencyInjection.shared.resolve(T.self)
|
||||||
}
|
}
|
||||||
|
|
||||||
var wrappedValue: T {
|
public var wrappedValue: T {
|
||||||
get {
|
get {
|
||||||
if let value = value {
|
if let value = value {
|
||||||
return value
|
return value
|
@ -0,0 +1,76 @@
|
|||||||
|
//
|
||||||
|
// DependencyInjectionTests.swift
|
||||||
|
// DependencyInjectionTests
|
||||||
|
//
|
||||||
|
// Created by Emre on 27/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import XCTest
|
||||||
|
@testable import DependencyInjection
|
||||||
|
|
||||||
|
class DependencyInjectionTests: XCTestCase {
|
||||||
|
|
||||||
|
override func setUpWithError() throws {
|
||||||
|
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||||
|
}
|
||||||
|
|
||||||
|
override func tearDownWithError() throws {
|
||||||
|
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||||
|
}
|
||||||
|
|
||||||
|
func testExample() throws {
|
||||||
|
// This is an example of a functional test case.
|
||||||
|
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||||
|
// Any test you write for XCTest can be annotated as throws and async.
|
||||||
|
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
|
||||||
|
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
|
||||||
|
}
|
||||||
|
|
||||||
|
func testPerformanceExample() throws {
|
||||||
|
// This is an example of a performance test case.
|
||||||
|
self.measure {
|
||||||
|
// Put the code you want to measure the time of here.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testInstance() {
|
||||||
|
DependencyInjection.shared.addSingleton(UserTest.self, UserTest(age: 10))
|
||||||
|
let view1 = View1()
|
||||||
|
let view2 = View2()
|
||||||
|
XCTAssertEqual(view1.getAge(), view2.getAge())
|
||||||
|
|
||||||
|
view1.setAge()
|
||||||
|
XCTAssertEqual(view1.getAge(), view2.getAge())
|
||||||
|
|
||||||
|
view2.setAge()
|
||||||
|
XCTAssertEqual(view1.getAge(), view2.getAge())
|
||||||
|
}
|
||||||
|
|
||||||
|
class UserTest {
|
||||||
|
public var age:Int
|
||||||
|
init(age:Int) {
|
||||||
|
self.age = age
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class View1 {
|
||||||
|
@Inject private var user:UserTest
|
||||||
|
func getAge() -> Int {
|
||||||
|
return user.age
|
||||||
|
}
|
||||||
|
func setAge() {
|
||||||
|
user.age = 20
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class View2 {
|
||||||
|
@Inject private var user:UserTest
|
||||||
|
func getAge() -> Int {
|
||||||
|
return user.age
|
||||||
|
}
|
||||||
|
func setAge() {
|
||||||
|
user.age = 40
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// Bet.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 28/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public protocol Bet {
|
||||||
|
//public private(set) var id: String
|
||||||
|
var theme: String { get set }
|
||||||
|
var phrase: String { get set }
|
||||||
|
var endRegisterDate: Date { get set }
|
||||||
|
var endBetDate: Date { get set }
|
||||||
|
var totalStakes: Int { get set }
|
||||||
|
var isPublic: Bool { get set }
|
||||||
|
var invited: [User] { get set }
|
||||||
|
var author: User { get set }
|
||||||
|
var registered: [User] { get set }
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// BetDataManager.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 29/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public protocol BetDataManager {
|
||||||
|
func getBets(withIndex index: Int, withCount count: Int) -> [Bet]
|
||||||
|
func getUsers(username: String) -> [User]
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
//
|
||||||
|
// BinaryBet.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 28/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct BinaryBet: Bet {
|
||||||
|
public var theme: String
|
||||||
|
public var phrase: String
|
||||||
|
public var endRegisterDate: Date
|
||||||
|
public var endBetDate: Date
|
||||||
|
public var totalStakes: Int
|
||||||
|
public var isPublic: Bool
|
||||||
|
public var invited: [User]
|
||||||
|
public var author: User
|
||||||
|
public var registered: [User]
|
||||||
|
|
||||||
|
public init(
|
||||||
|
theme: String,
|
||||||
|
phrase: String,
|
||||||
|
endRegisterDate: Date,
|
||||||
|
endBetDate: Date,
|
||||||
|
totalStakes: Int,
|
||||||
|
isPublic: Bool,
|
||||||
|
invited: [User],
|
||||||
|
author: User,
|
||||||
|
registered: [User]
|
||||||
|
) {
|
||||||
|
self.theme = theme
|
||||||
|
self.phrase = phrase
|
||||||
|
self.endRegisterDate = endRegisterDate
|
||||||
|
self.endBetDate = endBetDate
|
||||||
|
self.totalStakes = totalStakes
|
||||||
|
self.isPublic = isPublic
|
||||||
|
self.invited = invited
|
||||||
|
self.author = author
|
||||||
|
self.registered = registered
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// BinaryParticipation.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 28/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public enum YesNo {
|
||||||
|
case yes
|
||||||
|
case no
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct BinaryParticipation: Participation {
|
||||||
|
public var coinAmount: Int
|
||||||
|
public var date: Date
|
||||||
|
public var user: User
|
||||||
|
public var bet: Bet
|
||||||
|
public var answer: YesNo
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// CustomBet.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 28/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct CustomBet: Bet {
|
||||||
|
public var theme: String
|
||||||
|
public var phrase: String
|
||||||
|
public var endRegisterDate: Date
|
||||||
|
public var endBetDate: Date
|
||||||
|
public var totalStakes: Int
|
||||||
|
public var isPublic: Bool
|
||||||
|
public var invited: [User]
|
||||||
|
public var author: User
|
||||||
|
public var registered: [User]
|
||||||
|
public var possibleAnswers: [CustomBetResponse]
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// CustomBetResponse.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 28/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct CustomBetResponse {
|
||||||
|
public var name: String
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// CustomParticipation.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 28/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct CustomParticipation: Participation {
|
||||||
|
public var coinAmount: Int
|
||||||
|
public var date: Date
|
||||||
|
public var user: User
|
||||||
|
public var bet: Bet
|
||||||
|
public var answer: CustomBetResponse
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
//
|
||||||
|
// FactoryBet.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 09/01/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public protocol FactoryBet {
|
||||||
|
func toResponse()
|
||||||
|
func toModel() -> Bet
|
||||||
|
func toModel(theme: String, description: String, endRegister: Date, endBet: Date, isPublic: Bool, creator: User, type: Int) -> Bet
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// Manager.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 29/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct Manager {
|
||||||
|
let betDataManager: BetDataManager
|
||||||
|
let userDataManager: UserDataManager
|
||||||
|
|
||||||
|
public init(withBetDataManager betDataManager: BetDataManager, withUserDataManager userDataManager: UserDataManager){
|
||||||
|
self.betDataManager = betDataManager
|
||||||
|
self.userDataManager = userDataManager
|
||||||
|
}
|
||||||
|
|
||||||
|
public func addBet(bet: Bet) {
|
||||||
|
userDataManager.addBet(bet: bet)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// MatchBet.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 28/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct MatchBet: Bet {
|
||||||
|
public var theme: String
|
||||||
|
public var phrase: String
|
||||||
|
public var endRegisterDate: Date
|
||||||
|
public var endBetDate: Date
|
||||||
|
public var totalStakes: Int
|
||||||
|
public var isPublic: Bool
|
||||||
|
public var invited: [User]
|
||||||
|
public var author: User
|
||||||
|
public var registered: [User]
|
||||||
|
public var nameTeam1: String
|
||||||
|
public var nameTeam2: String
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// MatchParticipation.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 28/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct MatchParticipation: Participation {
|
||||||
|
public var coinAmount: Int
|
||||||
|
public var date: Date
|
||||||
|
public var user: User
|
||||||
|
public var bet: Bet
|
||||||
|
public var PointsTeam1: Int
|
||||||
|
public var PointsTeam2: Int
|
||||||
|
|
||||||
|
}
|
@ -1,6 +0,0 @@
|
|||||||
public struct Model {
|
|
||||||
public private(set) var text = "Hello, World!"
|
|
||||||
|
|
||||||
public init() {
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,16 @@
|
|||||||
|
//
|
||||||
|
// Participation.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 28/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public protocol Participation {
|
||||||
|
var coinAmount: Int { get set }
|
||||||
|
var date: Date { get set }
|
||||||
|
var user: User { get set }
|
||||||
|
var bet: Bet { get set }
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// User.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 11/10/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct User {
|
||||||
|
public var username: String
|
||||||
|
public var email: String
|
||||||
|
public var nbCoins: Int
|
||||||
|
public var friends: [User]
|
||||||
|
|
||||||
|
public init(username: String, email: String, nbCoins: Int, friends: [User]) {
|
||||||
|
self.username = username
|
||||||
|
self.email = email
|
||||||
|
self.nbCoins = nbCoins
|
||||||
|
self.friends = friends
|
||||||
|
}
|
||||||
|
|
||||||
|
public mutating func addFriend(user: User) {
|
||||||
|
self.friends.append(user)
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func mapUser(from json: [String: Any]) -> User? {
|
||||||
|
guard let username = json["username"] as? String,
|
||||||
|
let email = json["email"] as? String,
|
||||||
|
let nbCoins = json["nbCoins"] as? Int else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return User(username: username, email: email, nbCoins: nbCoins, friends: [])
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
//
|
||||||
|
// UserDataManager.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 29/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public protocol UserDataManager {
|
||||||
|
func getBets(withIndex index: Int, withCount count: Int) -> [Bet]
|
||||||
|
func addBet(bet: Bet)
|
||||||
|
func getFriends() -> [User]
|
||||||
|
}
|
@ -1,11 +0,0 @@
|
|||||||
import XCTest
|
|
||||||
@testable import Model
|
|
||||||
|
|
||||||
final class ModelTests: XCTestCase {
|
|
||||||
func testExample() throws {
|
|
||||||
// This is an example of a functional test case.
|
|
||||||
// Use XCTAssert and related functions to verify your tests produce the correct
|
|
||||||
// results.
|
|
||||||
XCTAssertEqual(Model().text, "Hello, World!")
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,26 @@
|
|||||||
|
// swift-tools-version: 5.8
|
||||||
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "StubLib",
|
||||||
|
products: [
|
||||||
|
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||||
|
.library(
|
||||||
|
name: "StubLib",
|
||||||
|
targets: ["StubLib"]),
|
||||||
|
],
|
||||||
|
dependencies: [
|
||||||
|
// Dependencies declare other packages that this package depends on.
|
||||||
|
// .package(url: /* package url */, from: "1.0.0"),
|
||||||
|
.package(name: "Model", path: "../Model")
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||||
|
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
||||||
|
.target(
|
||||||
|
name: "StubLib",
|
||||||
|
dependencies: ["Model"]),
|
||||||
|
]
|
||||||
|
)
|
@ -0,0 +1,3 @@
|
|||||||
|
# StubLib
|
||||||
|
|
||||||
|
A description of this package.
|
@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// BetStubManager.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 31/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Model
|
||||||
|
|
||||||
|
public struct BetStubManager: BetDataManager {
|
||||||
|
|
||||||
|
public init() {}
|
||||||
|
|
||||||
|
public func getBets(withIndex index: Int, withCount count: Int) -> [Bet] {
|
||||||
|
return Stub.shared.bets
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getUsers(username: String) -> [User] {
|
||||||
|
return Stub.shared.users
|
||||||
|
.filter { user in
|
||||||
|
user.username.contains(username)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
//
|
||||||
|
// Stub.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 01/01/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Model
|
||||||
|
|
||||||
|
struct Stub {
|
||||||
|
|
||||||
|
static var shared = Stub()
|
||||||
|
public var bets: [Bet] = []
|
||||||
|
public var users: [User] = []
|
||||||
|
|
||||||
|
public init() {
|
||||||
|
loadBets()
|
||||||
|
}
|
||||||
|
|
||||||
|
public mutating func loadBets() {
|
||||||
|
|
||||||
|
var user1 = User(username: "Lucas", email: "lucas.delanier@etu.uca.fr", nbCoins: 100, friends: [])
|
||||||
|
users.append(user1)
|
||||||
|
|
||||||
|
var user2 = User(username: "Imri", email: "emre.kartal@etu.uca.fr", nbCoins: 75, friends: [user1])
|
||||||
|
users.append(user2)
|
||||||
|
user1.addFriend(user: user2)
|
||||||
|
|
||||||
|
let user3 = User(username: "Arthur", email: "arthur.valin@etu.uca.fr", nbCoins: 30, friends: [user2])
|
||||||
|
users.append(user3)
|
||||||
|
user2.addFriend(user: user3)
|
||||||
|
|
||||||
|
let bet1 = BinaryBet(
|
||||||
|
theme: "Football - Finale de la Ligue des Champions",
|
||||||
|
phrase: "Le gagnant de la finale sera l'équipe avec le plus de tirs au but.",
|
||||||
|
endRegisterDate: Date().addingTimeInterval(86400),
|
||||||
|
endBetDate: Date().addingTimeInterval(172800),
|
||||||
|
totalStakes: 100,
|
||||||
|
isPublic: true,
|
||||||
|
invited: [],
|
||||||
|
author: user1,
|
||||||
|
registered: [user2]
|
||||||
|
)
|
||||||
|
self.bets.append(bet1)
|
||||||
|
|
||||||
|
let bet2 = BinaryBet(
|
||||||
|
theme: "Cuisine - Concours de cuisine en direct",
|
||||||
|
phrase: "Le plat préféré du jury sera une recette végétarienne.",
|
||||||
|
endRegisterDate: Date().addingTimeInterval(172800),
|
||||||
|
endBetDate: Date().addingTimeInterval(259200),
|
||||||
|
totalStakes: 150,
|
||||||
|
isPublic: false,
|
||||||
|
invited: [user3],
|
||||||
|
author: user1,
|
||||||
|
registered: [user2]
|
||||||
|
)
|
||||||
|
self.bets.append(bet2)
|
||||||
|
|
||||||
|
let bet3 = BinaryBet(
|
||||||
|
theme: "Technologie - Lancement d'un nouveau smartphone",
|
||||||
|
phrase: "Le nombre total de précommandes dépassera-t-il 1 million dans la première semaine ?",
|
||||||
|
endRegisterDate: Date().addingTimeInterval(259200),
|
||||||
|
endBetDate: Date().addingTimeInterval(345600),
|
||||||
|
totalStakes: 75,
|
||||||
|
isPublic: true,
|
||||||
|
invited: [],
|
||||||
|
author: user1,
|
||||||
|
registered: [user2, user1, user3]
|
||||||
|
)
|
||||||
|
self.bets.append(bet3)
|
||||||
|
|
||||||
|
let bet4 = BinaryBet(
|
||||||
|
theme: "Cinéma - Oscars 2024",
|
||||||
|
phrase: "Le film favori des critiques remportera-t-il le prix du meilleur film ?",
|
||||||
|
endRegisterDate: Date().addingTimeInterval(345600),
|
||||||
|
endBetDate: Date().addingTimeInterval(432000),
|
||||||
|
totalStakes: 120,
|
||||||
|
isPublic: false,
|
||||||
|
invited: [user1],
|
||||||
|
author: user2,
|
||||||
|
registered: [user3]
|
||||||
|
)
|
||||||
|
self.bets.append(bet4)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public mutating func add(bet: Bet) {
|
||||||
|
self.bets.append(bet)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
//
|
||||||
|
// UserStubManager.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 31/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Model
|
||||||
|
|
||||||
|
public struct UserStubManager: UserDataManager {
|
||||||
|
|
||||||
|
private var username: String
|
||||||
|
|
||||||
|
public init(username: String) {
|
||||||
|
self.username = username
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getBets(withIndex index: Int, withCount count: Int) -> [Bet] {
|
||||||
|
return Stub.shared.bets.filter { bet in
|
||||||
|
bet.registered.contains { user in
|
||||||
|
user.username == self.username
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func addBet(bet: Bet) {
|
||||||
|
Stub.shared.add(bet: bet)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getFriends() -> [User] {
|
||||||
|
return Stub.shared.users.filter { user in
|
||||||
|
user.friends.contains { friend in
|
||||||
|
friend.username == self.username
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
.DS_Store
|
||||||
|
/.build
|
||||||
|
/Packages
|
||||||
|
/*.xcodeproj
|
||||||
|
xcuserdata/
|
||||||
|
DerivedData/
|
||||||
|
.swiftpm/config/registries.json
|
||||||
|
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
||||||
|
.netrc
|
@ -0,0 +1,29 @@
|
|||||||
|
// swift-tools-version: 5.8
|
||||||
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "ViewModel",
|
||||||
|
platforms: [
|
||||||
|
.iOS(.v13)
|
||||||
|
],
|
||||||
|
products: [
|
||||||
|
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||||
|
.library(
|
||||||
|
name: "ViewModel",
|
||||||
|
targets: ["ViewModel"]),
|
||||||
|
],
|
||||||
|
dependencies: [
|
||||||
|
// Dependencies declare other packages that this package depends on.
|
||||||
|
// .package(url: /* package url */, from: "1.0.0"),
|
||||||
|
.package(name: "Model", path: "../Model")
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||||
|
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
||||||
|
.target(
|
||||||
|
name: "ViewModel",
|
||||||
|
dependencies: ["Model"]),
|
||||||
|
]
|
||||||
|
)
|
@ -0,0 +1,3 @@
|
|||||||
|
# ViewModel
|
||||||
|
|
||||||
|
A description of this package.
|
@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// ManagerVM.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Emre on 30/12/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Model
|
||||||
|
|
||||||
|
public class ManagerVM: ObservableObject {
|
||||||
|
@Published var model: Manager
|
||||||
|
|
||||||
|
public init(withModel model: Manager) {
|
||||||
|
self.model = model
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getPublicBets() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public func addBet(theme: String, description: String, endRegister: Date, endBet: Date, isPublic: Bool, creator: User) {
|
||||||
|
model.addBet(bet: BinaryBet(theme: theme, phrase: description, endRegisterDate: endRegister, endBetDate: endBet, totalStakes: 0, isPublic: isPublic, invited: [], author: creator, registered: []))
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue