Skip to content

Commit

Permalink
Expose MMMBestMatchingLanguage to ObjC
Browse files Browse the repository at this point in the history
  • Loading branch information
terwanerik committed Aug 5, 2022
1 parent 49b4043 commit c5aee66
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MMMCommonCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Pod::Spec.new do |s|

s.name = "MMMCommonCore"
s.version = "1.10.0"
s.version = "1.11.0"
s.summary = "Small bits and pieces reused in many pods from MMMTemple"
s.description = s.summary
s.homepage = "https://github.com/mediamonks/#{s.name}"
Expand Down
17 changes: 15 additions & 2 deletions Sources/MMMCommonCore/CommonCore.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// MMMCommonCore. Part of MMMTemple.
// Copyright (C) 2016-2020 MediaMonks. All rights reserved.
// Copyright (C) 2016-2022 MediaMonks. All rights reserved.
//

import Foundation
Expand Down Expand Up @@ -277,7 +277,20 @@ public func MMMBestMatchingLanguage(in languages: [String], preferredLanguage: S
)
}

public enum LanguageMatchingMode {
/// Objective-C bridge for MMMBestMatchingLanguage, since top-level functions are not supported.
/// Look at ``MMMBestMatchingLanguage(in:preferredLanguage:mode:)`` for more info.
@objc public final class MMMBestMatching: NSObject {

@objc public class func language(
in languages: [String],
preferredLanguage: String,
mode: LanguageMatchingMode
) -> String? {
return MMMBestMatchingLanguage(in: languages, preferredLanguage: preferredLanguage, mode: mode)
}
}

@objc public enum LanguageMatchingMode: Int {
/// Only return an element where both the "language" and the "region" parts of the identifier match.
case exact
/// If no exact match is available, then return an element where at least the "language" part matches,
Expand Down

0 comments on commit c5aee66

Please sign in to comment.