This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| [RequireComponent(typeof(Weapon))] | |
| public class Controller : MonoBehaviour | |
| { | |
| // Start is called before the first frame update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Group { | |
| VStack(alignment: .center) { | |
| ZStack { | |
| Circle() | |
| .fill(AssetColors.color(.onBlueColor)) | |
| .frame(width: scale - degreeLength, height: scale - degreeLength, alignment: .center) | |
| Circle() | |
| .stroke(AssetColors.color(.secondaryTextColor), style: StrokeStyle(lineWidth: degreeLength, lineCap: .butt, lineJoin: .miter, dash: [4])) | |
| .frame(width: scale, height: scale, alignment: .center) | |
| Circle() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| enum NetworkEnvironment: String { | |
| case openWeather = "https://api.openweathermap.org/data/2.5" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| protocol NetworkRoute { | |
| var path: String { get } | |
| var method: NetworkMethod { get } | |
| var headers: [String: String]? { get } | |
| } | |
| extension NetworkRoute { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| enum NetworkMethod: String { | |
| case get | |
| case post | |
| case put | |
| case patch | |
| case delete | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import Combine | |
| protocol Network { | |
| var decoder: JSONDecoder { get set } | |
| var enviroment: NetworkEnviroment { get set } | |
| } | |
| extension Network { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct OpenWeatherNetwork: Network { | |
| var decoder: JSONDecoder = JSONDecoder() | |
| var environment: NetworkEnvironment = .openWeather | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| enum OpenWeatherRoute { | |
| case weather | |
| } | |
| extension OpenWeatherRoute: NetworkRoute { | |
| var path: String { | |
| switch self { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import Combine | |
| protocol NetworkViewModel: ObservableObject { | |
| associatedtype NetworkResource: Decodable | |
| var objectWillChange: ObservableObjectPublisher { get } | |
| var resource: Resource<NetworkResource> { get set } | |
| var network: Network { get set } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class WeatherViewModel: NetworkViewModel, ObservableObject { | |
| typealias NetworkResource = Weather | |
| var resource: Resource<NetworkResource> = .loading | |
| var network: Network | |
| var route: NetworkRoute = OpenWeatherRoute.weather | |
| var bag: Set<AnyCancellable> = Set<AnyCancellable>() | |
| init(with network: Network) { |
OlderNewer