Skip to content

Commit

Permalink
Update Error image
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Jul 24, 2024
1 parent 9e3ff85 commit 880ca1c
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ let package = Package(
targets: ["OversizeModels"]
),
],
dependencies: productionDependencies,
dependencies: developmentDependencies,
targets: [
.target(
name: "OversizeModels",
dependencies: [
.product(name: "OversizeLocalizable", package: "OversizeLocalizable"),
]
],
resources: [.process("Resources")]
),
.testTarget(
name: "OversizeModelsTests",
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeModels/Error/LocationErrors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension AppError.Enums.Location: AppErrorProtocol {

public var image: Image? {
switch self {
default: return Image(.error)
default: return Image("Error", bundle: .module)
}
}

Expand Down
44 changes: 44 additions & 0 deletions Sources/OversizeModels/SwiftData/ColorData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Copyright © 2024 Alexander Romanov
// ColorData.swift, created on 13.06.2024
//

import SwiftUI

public struct ColorData: Codable {
private var red: Double = 1
private var green: Double = 1
private var blue: Double = 1
private var opacity: Double = 1

public var color: Color {
Color(red: red, green: green, blue: blue, opacity: opacity)
}

public init(red: Double, green: Double, blue: Double, opacity: Double) {
self.red = red
self.green = green
self.blue = blue
self.opacity = opacity
}

public init(color: Color) {
let components = color.cgColor?.components ?? []

if components.count > 0 {
red = Double(components[0])
}

if components.count > 1 {
green = Double(components[1])
}

if components.count > 2 {
blue = Double(components[2])
}

if components.count > 3 {
opacity = Double(components[3])
}
}
}
25 changes: 25 additions & 0 deletions Sources/OversizeModels/SwiftData/Coordinate2DData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Copyright © 2024 Alexander Romanov
// Coordinate2DData.swift, created on 13.06.2024
//

import MapKit

public struct Coordinate2DData: Codable {
public let latitude: Double
public let longitude: Double

public init(latitude: Double, longitude: Double) {
self.latitude = latitude
self.longitude = longitude
}

public init(_ location: CLLocationCoordinate2D) {
latitude = location.latitude
longitude = location.longitude
}

public var location: CLLocationCoordinate2D {
CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
}
}

0 comments on commit 880ca1c

Please sign in to comment.