Skip to content

Commit

Permalink
[Refactor] swift6.0 마이그레이션 (#613)
Browse files Browse the repository at this point in the history
* feat: swift6.0 업데이트, sendable protocol 적용, tuist 버전, complier version 수정

* feat: tca version up

* feat: SSCreateEnvelope 1차 작업

* feat: SSCreateEnvelope 2차 리팩토링

* feat: ssenvelope 리팩터링

* feat: sentMain 1차 리팩털이

* feat: sentMain 2차 리팩토링

* chore: tuist graph 업데이트, Alamofire Dependencies에 추가

* feat: received Module swift6 1차 리팩토링

* feat: Received Module swift6 리팩토링

Redundant : 중복의

* feat: Onboarding 모듈 swift6.0 리팩토링

* feat: vote 모듈 swift6.0 리팩토링

* feat: Statistics Module swift6.0 리팩토링

* bug: mystatistics bug 수정

* feat: myPage swift 6.0 마이그레이션

* feat: susu 어플리케이션 swift 6.0 마이그레이션

* prj: Build Version update

* feat: @preconcurrency import moya 의존성 제거
  • Loading branch information
MaraMincho authored Oct 4, 2024
1 parent 45885aa commit 56b536b
Show file tree
Hide file tree
Showing 210 changed files with 881 additions and 835 deletions.
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--swiftversion 5.9
--swiftversion 6.0

# format options

Expand Down
16 changes: 8 additions & 8 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ custom_rules:
- identifier
message: "Instead of #filePath, use #fileID."
severity: error
no_unchecked_sendable:
name: "`@unchecked Sendable` is discouraged."
regex: "@unchecked Sendable"
match_kinds:
- attribute.builtin
- typeidentifier
message: "Instead of using `@unchecked Sendable`, consider a safe alternative like a standard `Sendable` conformance or using `@preconcurrency import`. If you really must use `@unchecked Sendable`, you can add a `// swiftlint:disable:next no_unchecked_sendable` annotation with an explanation for how we know the type is thread-safe, and why we have to use @unchecked Sendable instead of Sendable. More explanation and suggested safe alternatives are available at https://github.com/airbnb/swift#unchecked-sendable."
severity: error
# no_unchecked_sendable:
# name: "`@unchecked Sendable` is discouraged."
# regex: "@unchecked Sendable"
# match_kinds:
# - attribute.builtin
# - typeidentifier
# message: "Instead of using `@unchecked Sendable`, consider a safe alternative like a standard `Sendable` conformance or using `@preconcurrency import`. If you really must use `@unchecked Sendable`, you can add a `// swiftlint:disable:next no_unchecked_sendable` annotation with an explanation for how we know the type is thread-safe, and why we have to use @unchecked Sendable instead of Sendable. More explanation and suggested safe alternatives are available at https://github.com/airbnb/swift#unchecked-sendable."
# severity: error
2 changes: 1 addition & 1 deletion .tuist-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.21.2
4.28.1
2 changes: 1 addition & 1 deletion Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let project = Project.makeModule(
"UILaunchStoryboardName": "LaunchScreen",
"BGTaskSchedulerPermittedIdentifiers": "com.oksusu.susu.app",
"CFBundleShortVersionString": "1.0.6",
"CFBundleVersion": "2024100235",
"CFBundleVersion": "2024100436",
"UIUserInterfaceStyle": "Light",
"ITSAppUsesNonExemptEncryption": "No",
"AppstoreAPPID": "6503701515",
Expand Down
2 changes: 1 addition & 1 deletion Projects/App/Sources/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Vote

// MARK: - ContentViewObject

final class ContentViewObject: ObservableObject {
final class ContentViewObject: ObservableObject, @unchecked Sendable {
@Published var nowScreenType: ScreenType = .launchScreen
@Published var type: SSTabType = .envelope

Expand Down
31 changes: 0 additions & 31 deletions Projects/Core/CommonExtension/Sources/AnyPublihser+Async.swift

This file was deleted.

2 changes: 1 addition & 1 deletion Projects/Core/CommonExtension/Sources/Date+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation

public extension String {
private static var ISODateFormatter: DateFormatter = {
private static let ISODateFormatter: DateFormatter = {
var dateFormatter = DateFormatter()
dateFormatter.dateFormat = Constants.iso8601DateFormatWithoutMiliSeconds
return dateFormatter
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// DispatchQueue.SchedulerTimeType.Stride + Sendable.swift
// CommonExtension
//
// Created by MaraMincho on 10/3/24.
// Copyright © 2024 com.oksusu. All rights reserved.
//

import Foundation

// MARK: - DispatchQueue.SchedulerTimeType.Stride + Sendable

extension DispatchQueue.SchedulerTimeType.Stride: @unchecked @retroactive Sendable {}
2 changes: 1 addition & 1 deletion Projects/Core/CommonExtension/Sources/JsonDecoder+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
import Foundation

public extension JSONEncoder {
static var `default`: JSONEncoder = .init()
static let `default`: JSONEncoder = .init()
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import OSLog
import UIKit

public enum SSCommonRouting {
@MainActor
public static func openAppStore() {
guard let appID = Bundle.main.infoDictionary?["AppstoreAPPID"] as? String,
let appStoreURL = URL(string: "itms-apps://itunes.apple.com/app/id\(appID)"),
Expand Down
12 changes: 6 additions & 6 deletions Projects/Core/FeatureAction/Sources/FeatureAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import SwiftUI

// MARK: - FeatureAction

public protocol FeatureAction {
associatedtype ViewAction
associatedtype InnerAction
associatedtype AsyncAction
associatedtype ScopeAction
associatedtype DelegateAction
public protocol FeatureAction: Sendable {
associatedtype ViewAction: Sendable
associatedtype InnerAction: Sendable
associatedtype AsyncAction: Sendable
associatedtype ScopeAction: Sendable
associatedtype DelegateAction: Sendable

/// NOTE: view 에서 사용되는 Action 을 정의합니다.
static func view(_: ViewAction) -> Self
Expand Down
4 changes: 2 additions & 2 deletions Projects/Core/FeatureAction/Sources/TCATaskManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

// MARK: - TCATaskManager

public struct TCATaskManager: Equatable {
public struct TCATaskManager: Equatable, Sendable {
private let originalTaskCount: Int
private var taskCount: Int
public init(taskCount: Int) {
Expand Down Expand Up @@ -52,7 +52,7 @@ public struct TCATaskManager: Equatable {

// MARK: - SingleTaskState

public enum SingleTaskState {
public enum SingleTaskState: Sendable {
case willRun
case didFinish
}
6 changes: 3 additions & 3 deletions Projects/Core/SSInterceptor/Sources/SSTokenInterceptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SSPersistancy

// MARK: - TokenInterceptHelpable

public protocol TokenInterceptHelpable {
public protocol TokenInterceptHelpable: Sendable {
func getToken() -> (accessToken: String, refreshToken: String)?
func getTokenData() throws -> Data
var accessTokenString: String { get }
Expand All @@ -16,7 +16,7 @@ public protocol TokenInterceptHelpable {

// MARK: - TokenInterceptHelper

final class TokenInterceptHelper: TokenInterceptHelpable {
final class TokenInterceptHelper: TokenInterceptHelpable, Sendable {
init() {}

private let keyChainShared = SSKeychain.shared
Expand Down Expand Up @@ -45,7 +45,7 @@ final class TokenInterceptHelper: TokenInterceptHelpable {

// MARK: - SSTokenInterceptor

public struct SSTokenInterceptor: RequestInterceptor {
public struct SSTokenInterceptor: RequestInterceptor, Sendable {
public static let shared: SSTokenInterceptor = .init(helper: TokenInterceptHelper())

var helper: TokenInterceptHelpable
Expand Down
2 changes: 1 addition & 1 deletion Projects/Core/SSNetwork/Sources/DataModel/BoardModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct BoardModel: Equatable, Codable {
public struct BoardModel: Equatable, Codable, Sendable {
/// 카테고리 아이디
public let id: Int64
/// 카테고리 이름
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

// MARK: - CategoryModel

public struct CategoryModel: Identifiable, Codable, Equatable {
public struct CategoryModel: Identifiable, Codable, Equatable, Sendable {
/// 카테고리 아이디
public let id: Int
/// 카테고리 순서
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

// MARK: - SearchEnvelopeResponseCategoryDTO

public struct CategoryWithCustomModel: Codable, Equatable {
public struct CategoryWithCustomModel: Codable, Equatable, Sendable {
/// 카테고리 아이디
public let id: Int
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct CreateVoteRequest: Equatable, Encodable {
public struct CreateVoteRequest: Equatable, Encodable, Sendable {
/// 투표 컨텐트
public let content: String
/// 투표 옵션
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct EnvelopeDetailResponse: Decodable, Equatable {
public struct EnvelopeDetailResponse: Decodable, Equatable, Sendable {
public let envelope: EnvelopeModel
public let category: CategoryWithCustomModel
public let relationship: RelationshipModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct EnvelopeModel: Codable, Equatable {
public struct EnvelopeModel: Codable, Equatable, Sendable {
/// 봉투 id
public let id: Int64
/// user id, 소유자
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

// MARK: - FriendModel

public struct FriendModel: Codable, Equatable {
public struct FriendModel: Codable, Equatable, Sendable {
public let id: Int64
public let name: String
public let phoneNumber: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct FriendRelationshipModel: Codable, Equatable {
public struct FriendRelationshipModel: Codable, Equatable, Sendable {
/// 지인 ID
public let id: Int64
/// 지인 ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

// MARK: - PageResponseDtoSearchEnvelopeRequest

public struct PageResponseDtoSearchEnvelopeRequest {
public struct PageResponseDtoSearchEnvelopeRequest: Sendable {
public var friendIds: [Int64] = []
public var friendName: String?
public var ledgerId: Int64?
Expand Down Expand Up @@ -46,13 +46,13 @@ public struct PageResponseDtoSearchEnvelopeRequest {
self.sort = sort
}

public enum CurrentTypes: String, CustomStringConvertible {
public enum CurrentTypes: String, CustomStringConvertible, Sendable {
case received
case sent
public var description: String { rawValue.uppercased() }
}

public enum IncludeType: String, CustomStringConvertible, CaseIterable {
public enum IncludeType: String, CustomStringConvertible, CaseIterable, Sendable {
case category = "CATEGORY"
case friend = "FRIEND"
case relationship = "RELATIONSHIP"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import Foundation

// MARK: - PageResponseDtoSearchEnvelopeResponse

public struct PageResponseDtoSearchEnvelopeResponse: Equatable, Codable {
public let data: [SearchEnvelopeResponse]
public let page: Int?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

// MARK: - SearchEnvelopeResponseRelationshipDTO

public struct RelationshipModel: Codable, Equatable, Identifiable {
public struct RelationshipModel: Codable, Equatable, Identifiable, Sendable {
/// 관계 ID
public let id: Int
/// 관계 이름
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

// MARK: - SUSUEnvelopeStatisticResponse

public struct SUSUEnvelopeStatisticResponse: Decodable, Equatable {
public struct SUSUEnvelopeStatisticResponse: Decodable, Equatable, Sendable {
/// 평균 보낸 비용
public let averageSent: Int64?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@

import Foundation

public struct UpdateVoteRequest: Encodable, Equatable {
public struct UpdateVoteRequest: Encodable, Sendable {
/// 보드 id
public let boardID: Int64
/// 투표 내용
public let content: String

enum CodingKeys: String, CodingKey {
case boardID = "boardId"
case content
}

public init(boardID: Int64, content: String) {
self.boardID = boardID
self.content = content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

// MARK: - UserEnvelopeStatisticResponse

public struct UserEnvelopeStatisticResponse: Equatable, Decodable {
public struct UserEnvelopeStatisticResponse: Equatable, Decodable, Sendable {
/// 최근 사용 금액
public let recentSpent: [TitleValueModelLong]?
/// 경조사를 가장 많이 쓴 달
Expand All @@ -26,19 +26,21 @@ public struct UserEnvelopeStatisticResponse: Equatable, Decodable {
}

public extension UserEnvelopeStatisticResponse {
static var emptyState: Self = .init(
recentSpent: nil,
mostSpentMonth: nil,
mostRelationship: nil,
mostCategory: nil,
highestAmountReceived: nil,
highestAmountSent: nil
)
static var emptyState: Self {
.init(
recentSpent: nil,
mostSpentMonth: nil,
mostRelationship: nil,
mostCategory: nil,
highestAmountReceived: nil,
highestAmountSent: nil
)
}
}

// MARK: - TitleValueModelLong

public struct TitleValueModelLong: Equatable, Decodable {
public struct TitleValueModelLong: Equatable, Decodable, Sendable {
public let title: String
public let value: Int64

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

// MARK: - UserInfoResponseDTO

public struct UserInfoResponse: Equatable, Decodable {
public struct UserInfoResponse: Equatable, Decodable, Sendable {
/// 내 아이디
public let id: Int64
/// 내 이름
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct UserProfileModel: Equatable, Decodable {
public struct UserProfileModel: Equatable, Decodable, Sendable {
/// 유저 id
public let id: Int64
/// 이름
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct VoteAllInfoResponse: Equatable, Decodable {
public struct VoteAllInfoResponse: Equatable, Decodable, Sendable {
/// 투표 id
public let id: Int64
/// 본인 소유 글 여부 / 내 글 : 1, 전체 글 : 0
Expand Down
Loading

0 comments on commit 56b536b

Please sign in to comment.