You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
697 B
38 lines
697 B
//
|
|
// BetViewModel.swift
|
|
// AllIn
|
|
//
|
|
// Created by Emre on 30/12/2023.
|
|
//
|
|
|
|
import Foundation
|
|
import DependencyInjection
|
|
import ViewModel
|
|
import Model
|
|
import Combine
|
|
|
|
class BetViewModel: ObservableObject {
|
|
|
|
@Inject var manager: ManagerVM
|
|
|
|
@Published private var internalBets: [Bet] = []
|
|
|
|
var bets: [Bet] {
|
|
return internalBets
|
|
}
|
|
|
|
init() {
|
|
getItems()
|
|
}
|
|
|
|
func getItems() {
|
|
for bet in manager.bets {
|
|
print(bet.theme)
|
|
}
|
|
manager.$bets.assign(to: \.internalBets, on: self).store(in: &cancellables)
|
|
manager.getPublicBets()
|
|
}
|
|
|
|
private var cancellables: Set<AnyCancellable> = []
|
|
}
|