Skip to content

Commit

Permalink
Fixed project for SPM
Browse files Browse the repository at this point in the history
  • Loading branch information
izyumkin committed Dec 25, 2022
1 parent ca6b39b commit 4fb2755
Show file tree
Hide file tree
Showing 10 changed files with 366 additions and 383 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.swiftpm/
.DS_Store
25 changes: 25 additions & 0 deletions MCEmojiPicker.xcodeproj/MCEmojiPicker_Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
612 changes: 242 additions & 370 deletions MCEmojiPicker.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "mcemojipicker::MCEmojiPicker"
BuildableName = "MCEmojiPicker.framework"
BlueprintName = "MCEmojiPicker"
ReferencedContainer = "container:MCEmojiPicker.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version: 5.7

import PackageDescription

Expand Down
21 changes: 21 additions & 0 deletions Sources/MCEmojiPicker/Resource/Extensions/Bundle+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Bundle+Extension.swift
// MCEmojiPicker
//
// Created by Иван Изюмкин on 25.12.2022.
//

import Foundation

#if !SPM
extension Bundle {
/// Localization bundle.
static var module: Bundle {
let path = Bundle(for: MCUnicodeManager.self).path(
forResource: "MCEmojiPicker",
ofType: "bundle"
) ?? ""
return Bundle(path: path) ?? Bundle.main
}
}
#endif
19 changes: 8 additions & 11 deletions Sources/MCEmojiPicker/Services/MCUnicodeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,26 @@ final class MCUnicodeManager: MCUnicodeManagerProtocol {
- Parameter type: Emoji category type.
*/
public func getEmojiCategoryTitle(for type: MCEmojiCategoryType) -> String {
let path = Bundle(for: MCUnicodeManager.self).path(forResource: "MCEmojiPicker", ofType: "bundle") ?? ""
// Localization bundle.
let bundle = Bundle(path: path) ?? Bundle.main
// Localization file name.
let localizationTableName = "MCEmojiPickerLocalizable"

switch type {
case .people:
return NSLocalizedString("emotionsAndPeople", tableName: localizationTableName, bundle: bundle, comment: "")
return NSLocalizedString("emotionsAndPeople", tableName: localizationTableName, bundle: .module, comment: "")
case .nature:
return NSLocalizedString("animalsAndNature", tableName: localizationTableName, bundle: bundle, comment: "")
return NSLocalizedString("animalsAndNature", tableName: localizationTableName, bundle: .module, comment: "")
case .foodAndDrink:
return NSLocalizedString("foodAndDrinks", tableName: localizationTableName, bundle: bundle, comment: "")
return NSLocalizedString("foodAndDrinks", tableName: localizationTableName, bundle: .module, comment: "")
case .activity:
return NSLocalizedString("activities", tableName: localizationTableName, bundle: bundle, comment: "")
return NSLocalizedString("activities", tableName: localizationTableName, bundle: .module, comment: "")
case .travelAndPlaces:
return NSLocalizedString("travellingAndPlaces", tableName: localizationTableName, bundle: bundle, comment: "")
return NSLocalizedString("travellingAndPlaces", tableName: localizationTableName, bundle: .module, comment: "")
case .objects:
return NSLocalizedString("items", tableName: localizationTableName, bundle: bundle, comment: "")
return NSLocalizedString("items", tableName: localizationTableName, bundle: .module, comment: "")
case .symbols:
return NSLocalizedString("symbols", tableName: localizationTableName, bundle: bundle, comment: "")
return NSLocalizedString("symbols", tableName: localizationTableName, bundle: .module, comment: "")
case .flags:
return NSLocalizedString("flags", tableName: localizationTableName, bundle: bundle, comment: "")
return NSLocalizedString("flags", tableName: localizationTableName, bundle: .module, comment: "")
}
}
}

0 comments on commit 4fb2755

Please sign in to comment.