Skip to content

Commit

Permalink
Fixed concurrency for swift
Browse files Browse the repository at this point in the history
  • Loading branch information
chicio committed Oct 11, 2024
1 parent bdd5423 commit 412798b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
};
name = Debug;
};
Expand Down Expand Up @@ -737,6 +738,7 @@
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_STRICT_CONCURRENCY = complete;
};
name = Release;
};
Expand Down
2 changes: 2 additions & 0 deletions ID3TagEditor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -847,6 +848,7 @@
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ID3FramesWithLocalizedContentCreatorFactory {
let paddingAdder = PaddingAdderToEndOfContentUsingNullChar()

return ID3FramesWithLocalizedContentCreator(
localizedFrameNames: frameNamesWithLocalizedContent,
localizedFrameNames: FrameNamesWithLocalizedContent().get(),
localizedFrameCreator: ID3LocalizedFrameCreator(
id3FrameConfiguration: frameConfiguration,
frameHeaderCreator: ID3FrameHeaderCreatorFactory.make(),
Expand Down
18 changes: 12 additions & 6 deletions Source/Frame/FrameName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,26 @@

import Foundation

func enumerateLocalizedFrameName(frameName: (ID3FrameContentLanguage) -> FrameName) -> [FrameName] {
return ID3FrameContentLanguage.allCases.map({ frameName($0) })
struct FrameNamesWithLocalizedContent {
func get() -> [FrameType: [FrameName]] {
return [
FrameType.unsyncronisedLyrics: enumerateLocalizedFrameName(frameName: FrameName.unsynchronizedLyrics),
FrameType.comment: enumerateLocalizedFrameName(frameName: FrameName.comment)
]
}

private func enumerateLocalizedFrameName(frameName: (ID3FrameContentLanguage) -> FrameName) -> [FrameName] {
return ID3FrameContentLanguage.allCases.map({ frameName($0) })
}
}

let frameNamesWithLocalizedContent = [
FrameType.unsyncronisedLyrics: enumerateLocalizedFrameName(frameName: FrameName.unsynchronizedLyrics),
FrameType.comment: enumerateLocalizedFrameName(frameName: FrameName.comment)
]

/// An enum used to identify the different types of frame parsed by the ID3TagEditor.
/// This must be used to acces the frame data as identifier inside the dictionary
/// of frame in the `ID3tag` `frames` properties.
public enum FrameName: Equatable, Hashable, CaseIterable {
public static var allCases: [FrameName] {
let frameNamesWithLocalizedContent = FrameNamesWithLocalizedContent().get()
return [
.title,
.album,
Expand Down

0 comments on commit 412798b

Please sign in to comment.