Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade swift version to 6 for Data layer target #192

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PresentationLayer/Constants/WeatherFields.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftUI
import DomainLayer
import Toolkit

extension WeatherField: CustomStringConvertible {
extension WeatherField: @retroactive CustomStringConvertible {

static var stationListFields: [WeatherField] {
[.temperature, .wind, .humidity, .precipitation]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import DomainLayer
import Toolkit

extension CurrentWeather: Identifiable {
extension CurrentWeather: @retroactive Identifiable {
public var id: String {
timestamp ?? ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import DomainLayer
typealias StateFontAwesome = (icon: FontIcon, color: ColorEnum, font: FontAwesome)

extension UserDeviceFollowState {
static let defaultFAIcon: StateFontAwesome = (FontIcon.heart, ColorEnum.favoriteHeart, FontAwesome.FAPro)
nonisolated(unsafe) static let defaultFAIcon: StateFontAwesome = (FontIcon.heart, ColorEnum.favoriteHeart, FontAwesome.FAPro)

enum State {
case owned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import SwiftUI
import DomainLayer
@preconcurrency import DomainLayer

private extension WeatherField {
func attributedString(from weather: CurrentWeather?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import SwiftUI
import DomainLayer
@preconcurrency import DomainLayer

struct WeatherOverviewView: View {
var mode: Mode = .default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct SizeObserver: ViewModifier {

private struct FramePreferenceKey: PreferenceKey {
typealias Value = CGRect
static var defaultValue: Value = .zero
nonisolated(unsafe) static var defaultValue: Value = .zero

static func reduce(value _: inout Value, nextValue: () -> Value) {
_ = nextValue()
Expand Down
4 changes: 2 additions & 2 deletions PresentationLayer/Utils/Weather/WeatherUnitsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Toolkit
import DomainLayer

class WeatherUnitsManager: ObservableObject {

static let `default`: WeatherUnitsManager = {
nonisolated(unsafe) static let `default`: WeatherUnitsManager = {
let useCase = SwinjectHelper.shared.getContainerForSwinject().resolve(MainUseCase.self)!
let manager = WeatherUnitsManager(mainUseCase: useCase)

Expand Down
2 changes: 1 addition & 1 deletion station-intent/IntentHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Intents
import DomainLayer
@preconcurrency import DomainLayer
import Combine
import Toolkit

Expand Down
2 changes: 1 addition & 1 deletion station-widget/Extenstions/DeviceDetails+Widget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Pantelis Giazitsis on 18/10/23.
//

import DomainLayer
@preconcurrency import DomainLayer

// MARK: - Mock

Expand Down
4 changes: 2 additions & 2 deletions station-widget/StationTimelineEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import Foundation
import WidgetKit
import DomainLayer
@preconcurrency import DomainLayer

struct StationTimelineEntry: TimelineEntry {
struct StationTimelineEntry: @unchecked Sendable, TimelineEntry {
let date: Date
let displaySize: CGSize
let timelineCase: TimelineCase
Expand Down
15 changes: 9 additions & 6 deletions station-widget/Station_widget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import WidgetKit
import SwiftUI
import DomainLayer
@preconcurrency import DomainLayer
import Toolkit

struct Provider: IntentTimelineProvider {
struct Provider: IntentTimelineProvider, @unchecked Sendable {
private let useCase: WidgetUseCase
private let cancellableWrapper: CancellableWrapper = .init()
private let refreshInterval: TimeInterval = 5.0 * 60.0 // 5 mins
Expand Down Expand Up @@ -49,19 +49,22 @@ struct Provider: IntentTimelineProvider {
completion(entry)
}

func getTimeline(for configuration: StationWidgetConfigurationIntent,

func getTimeline(for configuration: StationWidgetConfigurationIntent,
in context: Context,
completion: @escaping (Timeline<StationTimelineEntry>) -> Void) {
completion: @escaping @Sendable (Timeline<StationTimelineEntry>) -> Void) {

let nextUpdate = Date.now.advanced(by: refreshInterval)
let displaySize = context.displaySize
Task {
let entry = await getEntry(for: configuration.selectedStation, displaySize: displaySize)
nonisolated(unsafe) let station = configuration.selectedStation
Task { @MainActor in
let entry = await getEntry(for: station, displaySize: displaySize)
let timeline = Timeline(entries: [entry], policy: .after(nextUpdate))
completion(timeline)
}
}

nonisolated
private func getEntry(for station: Station?, displaySize: CGSize) async -> StationTimelineEntry {
let isUserLoggedIn = useCase.isUserLoggedIn
guard let result = try? await useCase.getDevices(useCache: true) else {
Expand Down
2 changes: 1 addition & 1 deletion station-widget/Views/ErrorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import SwiftUI
import DomainLayer
@preconcurrency import DomainLayer
import WidgetKit

struct ErrorView: View {
Expand Down
2 changes: 1 addition & 1 deletion station-widget/Views/StationWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import SwiftUI
import WidgetKit
import DomainLayer
@preconcurrency import DomainLayer

struct StationWidgetView: View {
let entry: StationTimelineEntry
Expand Down
18 changes: 12 additions & 6 deletions wxm-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3532,7 +3532,8 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -3565,7 +3566,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Mock;
Expand Down Expand Up @@ -3599,7 +3601,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down Expand Up @@ -3719,7 +3722,8 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -3755,7 +3759,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Mock;
Expand Down Expand Up @@ -3791,7 +3796,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion wxm-ios.xcodeproj/xcshareddata/xcschemes/wxm-ios.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
11 changes: 7 additions & 4 deletions wxm-ios/DataLayer/DataLayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1530;
LastUpgradeCheck = 1610;
TargetAttributes = {
B5799E7228254CC100FEBB85 = {
CreatedOnToolsVersion = 13.3;
Expand Down Expand Up @@ -719,7 +719,8 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = MOCK;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Mock;
Expand Down Expand Up @@ -877,7 +878,8 @@
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
Expand Down Expand Up @@ -912,7 +914,8 @@
SUPPORTS_MACCATALYST = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = RELEASE;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
LastUpgradeVersion = "1610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion wxm-ios/DataLayer/DataLayer/Database/DatabaseService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import CoreData

class DatabaseService {

static let shared: DatabaseService = DatabaseService()
nonisolated(unsafe) static let shared: DatabaseService = DatabaseService()

var context: NSManagedObjectContext {
persistentContainer.viewContext
Expand Down
2 changes: 1 addition & 1 deletion wxm-ios/DataLayer/DataLayer/Networking/ApiClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class ApiClient {
return session
}()

static let shared: ApiClient = ApiClient()
nonisolated(unsafe) static let shared: ApiClient = ApiClient()

#warning("TODO: Improve publishers caching. For now, we perform everything in main thread to avoid race conditions")
private let queue = DispatchQueue.main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Alamofire
import DomainLayer
@preconcurrency import DomainLayer
import Foundation

enum MeApiRequestBuilder: URLRequestConvertible {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
// Created by Hristos Condrea on 8/8/22.
//

import Alamofire
import Combine
import DomainLayer
@preconcurrency import Alamofire
@preconcurrency import Combine
@preconcurrency import DomainLayer
import Toolkit
import UIKit

class AuthInterceptor: RequestInterceptor {
class AuthInterceptor: @unchecked Sendable, RequestInterceptor {
let retryLimit = 4
let retryDelay: TimeInterval = 1
let keychainHelperService = KeychainHelperService()
Expand Down
Loading