Skip to content
Open
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
6 changes: 4 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ let package = Package(
.package(url: "https://github.com/what3words/w3w-swift-design.git", "1.0.0" ..< "2.0.0"),
.package(url: "[email protected]:what3words/w3w-swift-design-swiftui.git", "1.0.0" ..< "2.0.0"),
.package(url: "[email protected]:w3w-internal/w3w-swift-app-events.git", "5.0.0" ..< "6.0.0"),
.package(url: "https://github.com/what3words/w3w-swift-presenters.git", "1.0.0" ..< "2.0.0")
.package(url: "https://github.com/what3words/w3w-swift-presenters.git", "1.0.0" ..< "2.0.0"),
.package(url: "[email protected]:w3w-internal/w3w-swift-app-types.git", "5.0.0"..<"6.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand All @@ -35,7 +36,8 @@ let package = Package(
.product(name: "W3WSwiftDesign", package: "w3w-swift-design"),
.product(name: "W3WSwiftDesignSwiftUI", package: "w3w-swift-design-swiftui"),
.product(name: "W3WSwiftPresenters", package: "w3w-swift-presenters"),
.product(name: "W3WSwiftAppEvents", package: "w3w-swift-app-events")
.product(name: "W3WSwiftAppEvents", package: "w3w-swift-app-events"),
.product(name: "W3WSwiftAppTypes", package: "w3w-swift-app-types")
],
resources: [.process("Resources")]
),
Expand Down
21 changes: 21 additions & 0 deletions Sources/W3WSwiftComponentsOcr/Lib/Ocr/W3WOcrDataTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,27 @@ public struct W3WOcrLanguage { //}: Hashable {
public static let english = W3WOcrLanguage(name: "English", nativeName: "English", code: "en")
}

public extension W3WRfcLanguageProtocol {
/// convert W3WRfcLanguage to W3WOcrLanguage
func toW3WOcrLanguage() -> W3WOcrLanguage? {
guard let langCode, !langCode.isEmpty else { return nil }
if let language = self as? W3WRfcLanguage {
return W3WOcrLanguage(name: language.name , nativeName: language.nativeName, code: langCode)
} else {
return W3WOcrLanguage(name: LanguageUtils.getLanguageName(forLocale: langCode, inLocale: "en"),
nativeName: LanguageUtils.getLanguageName(forLocale: langCode, inLocale: langCode),
code: langCode)
}
}
}

@available(iOS 13.0.0, *)
@available(watchOS 6.0.0, *)
extension W3WOcrLanguage: W3WRfcLanguageConvertable {
public func toRfcLanguage() -> some W3WRfcLanguageProtocol {
return W3WRfcLanguage(from: code)
}
}

// as in the Sdk
public struct W3WOcrSuggestion: W3WSuggestion {
Expand Down

This file was deleted.