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

Swift 6 #259

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "ff3d2212b6b093db7f177d0855adbc4ef9c5f036",
"version" : "1.0.3"
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
}
},
{
Expand Down Expand Up @@ -77,8 +77,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/VergeGroup/Verge.git",
"state" : {
"revision" : "ea8f1e54ceec3078215762ca6ea73c7b93fc266c",
"version" : "12.5.0"
"revision" : "9980b550f17ad6bc6d557a220561061a436fb231",
"version" : "13.0.0-beta.1"
}
}
],
Expand Down
9 changes: 5 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// swift-tools-version:5.9
// swift-tools-version:6.0
import PackageDescription

let package = Package(
name: "Brightroom",
platforms: [
.iOS(.v15)
.iOS(.v16)
],
products: [
.library(name: "BrightroomEngine", targets: ["BrightroomUI"]),
.library(name: "BrightroomUI", targets: ["BrightroomUI"]),
.library(name: "BrightroomUIPhotosCrop", targets: ["BrightroomUIPhotosCrop"])
],
dependencies: [
.package(url: "https://github.com/VergeGroup/Verge", from: "12.5.0"),
.package(url: "https://github.com/VergeGroup/Verge", from: "13.0.0-beta.1"),
.package(url: "https://github.com/FluidGroup/TransitionPatch", from: "1.0.3"),
.package(url: "https://github.com/FluidGroup/PrecisionLevelSlider", from: "2.1.0"),
],
Expand All @@ -29,5 +29,6 @@ let package = Package(
name: "BrightroomUIPhotosCrop",
dependencies: ["BrightroomUI", "PrecisionLevelSlider"]
)
]
],
swiftLanguageModes: [.v6]
)
2 changes: 1 addition & 1 deletion Sources/BrightroomEngine/ColorCube/ColorCubeHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ extension ColorCubeHelper {
}
}

let cache = NSCache<NSString, CIFilter>()
nonisolated(unsafe) let cache = NSCache<NSString, CIFilter>()
35 changes: 0 additions & 35 deletions Sources/BrightroomEngine/ColorCube/ColorCubeStorage.swift

This file was deleted.

19 changes: 5 additions & 14 deletions Sources/BrightroomEngine/Core/EditingStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import CoreImage
@preconcurrency import CoreImage
import MetalKit
import SwiftUI
import UIKit
Expand All @@ -34,7 +34,7 @@ public enum EditingStackError: Error {
///
/// - Attension: Source text
/// Please make sure of EditingStack is started state before editing in UI with calling `start()`.
open class EditingStack: Hashable, StoreComponentType {
open class EditingStack: Hashable, StoreDriverType {

private static let centralQueue = DispatchQueue.init(
label: "app.muukii.Brightroom.EditingStack.central",
Expand Down Expand Up @@ -238,7 +238,6 @@ open class EditingStack: Hashable, StoreComponentType {
/// - modifyCrop: A chance to modify cropping. It runs in background-thread. CIImage is not original image.
public init(
imageProvider: ImageProvider,
colorCubeStorage: ColorCubeStorage = .default,
presetStorage: PresetStorage = .default,
options: Options = .init(),
cropModifier: CropModifier = .init(modify: { _, c, completion in completion(c) })
Expand All @@ -250,15 +249,7 @@ open class EditingStack: Hashable, StoreComponentType {
initialState: .init()
)

filterPresets =
colorCubeStorage.filters.map {
FilterPreset(
name: $0.name,
identifier: $0.identifier,
filters: [$0.asAny()],
userInfo: [:]
)
} + presetStorage.presets
filterPresets = presetStorage.presets

self.imageProvider = imageProvider
}
Expand Down Expand Up @@ -299,8 +290,8 @@ open class EditingStack: Hashable, StoreComponentType {
Start downloading image
*/

backgroundQueue.async {
self.imageProvider.start()
backgroundQueue.async { [imageProvider] in
imageProvider.start()
}

imageProviderSubscription =
Expand Down
8 changes: 4 additions & 4 deletions Sources/BrightroomEngine/Core/Filtering.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum RadiusCalculator {
}
}

public protocol Filtering: Hashable {
public protocol Filtering: Hashable, Sendable {

func apply(to image: CIImage, sourceImage: CIImage) -> CIImage
}
Expand All @@ -43,7 +43,7 @@ extension Filtering {
}
}

public struct AnyFilter: Filtering {
public struct AnyFilter: Filtering, Sendable {

public static func == (lhs: AnyFilter, rhs: AnyFilter) -> Bool {
lhs.base == rhs.base
Expand All @@ -53,8 +53,8 @@ public struct AnyFilter: Filtering {
base.hash(into: &hasher)
}

private let applier: (CIImage, CIImage) -> CIImage
public let base: AnyHashable
private let applier: @Sendable (CIImage, CIImage) -> CIImage
public nonisolated(unsafe) let base: AnyHashable

public init<Filter: Filtering>(filter: Filter) {
self.base = filter
Expand Down
2 changes: 1 addition & 1 deletion Sources/BrightroomEngine/Core/ParameterRange.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import UIKit

public struct ParameterRange<T : Comparable, Target> {
public struct ParameterRange<T : Comparable & Sendable, Target>: Sendable {

public let min: T
public let max: T
Expand Down
Loading
Loading