Skip to content

Instantly share code, notes, and snippets.

View unboxme's full-sized avatar
🎮
Remote

Pavel Puzyrev unboxme

🎮
Remote
  • Nicosia, Cyprus
View GitHub Profile
@csknns
csknns / replacePlistEnvironmentVariables.swift
Last active April 14, 2023 08:35
Replaces referenced environment variables (e.g. $(BUILD_VERSION)) in a plist file
// Usage:
// $/usr/bin/xcrun --sdk macosx swift replacePlistEnvironmentVariables.swift "$inputfile.plist" "$outputfile"
// This will replace all the referenced enviroment variables with their value, for example:
// <string>$(A_VARIABLE)</string>
import Foundation
enum ScriptError: Error {
case invalidPlistArgument(argument: URL)
case sameInputAndOutptFile
}
@steipete
steipete / FirebaseCoordinator.swift
Created April 13, 2020 13:38
If you're as confused as I am that there's an API for custom options, yet Google still requires a file named GoogleService-Info.plist in your app, here's some swizzling that fixes that for ya. All Swift :)
class FirebaseCoordinator {
static let shared = FirebaseCoordinator()
static let initialize: Void = {
/// We modify Google Firebase (and eventually Analytics) to load the mac-specific plist at runtime.
/// Google enforces that we have a file named "GoogleService-Info.plist" in the app resources.
/// This is unfortunate since we need two different files based on iOS and Mac version
/// One solution is a custom build step that copies in the correct file:
/// https://stackoverflow.com/questions/37615405/use-different-googleservice-info-plist-for-different-build-schemes
/// However, this is basically impossible since Catalyst doesn't set any custom build variables, so detection is extremely difficult.
/// We swizzle to modify the loading times.