Skip to content

Commit

Permalink
ADD: SPM Setting - Firebase analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
psychehose committed Aug 29, 2022
1 parent 2718705 commit 7b10048
Show file tree
Hide file tree
Showing 1,053 changed files with 64,487 additions and 4 deletions.
31 changes: 31 additions & 0 deletions Hous-iOS-release.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
7702A0F128BD0C4900DA7712 /* Analytics in Frameworks */ = {isa = PBXBuildFile; productRef = 7702A0F028BD0C4900DA7712 /* Analytics */; };
7717A84D28BBB89700C449CC /* ThirdPartyLibraryManager in Frameworks */ = {isa = PBXBuildFile; productRef = 7717A84C28BBB89700C449CC /* ThirdPartyLibraryManager */; };
777C666128A74A62000BECEA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 777C666028A74A62000BECEA /* AppDelegate.swift */; };
777C666328A74A62000BECEA /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 777C666228A74A62000BECEA /* SceneDelegate.swift */; };
777C666A28A74A63000BECEA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 777C666928A74A63000BECEA /* Assets.xcassets */; };
Expand All @@ -16,6 +18,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
7702A0F228BD245E00DA7712 /* Network */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Network; sourceTree = "<group>"; };
7717A84B28BBB5E300C449CC /* ThirdPartyLibraryManager */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = ThirdPartyLibraryManager; sourceTree = "<group>"; };
777C665D28A74A62000BECEA /* Hous-iOS-release.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Hous-iOS-release.app"; sourceTree = BUILT_PRODUCTS_DIR; };
777C666028A74A62000BECEA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
777C666228A74A62000BECEA /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -34,17 +38,29 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7717A84D28BBB89700C449CC /* ThirdPartyLibraryManager in Frameworks */,
7702A0F128BD0C4900DA7712 /* Analytics in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
7705A45328BBB388000237BA /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
777C665428A74A62000BECEA = {
isa = PBXGroup;
children = (
7702A0F228BD245E00DA7712 /* Network */,
7717A84B28BBB5E300C449CC /* ThirdPartyLibraryManager */,
777C665F28A74A62000BECEA /* Hous-iOS-release */,
777C665E28A74A62000BECEA /* Products */,
7705A45328BBB388000237BA /* Frameworks */,
);
indentWidth = 2;
sourceTree = "<group>";
Expand Down Expand Up @@ -147,6 +163,10 @@
dependencies = (
);
name = "Hous-iOS-release";
packageProductDependencies = (
7717A84C28BBB89700C449CC /* ThirdPartyLibraryManager */,
7702A0F028BD0C4900DA7712 /* Analytics */,
);
productName = "Hous-iOS-release";
productReference = 777C665D28A74A62000BECEA /* Hous-iOS-release.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -792,6 +812,17 @@
defaultConfigurationName = "Release(Production)";
};
/* End XCConfigurationList section */

/* Begin XCSwiftPackageProductDependency section */
7702A0F028BD0C4900DA7712 /* Analytics */ = {
isa = XCSwiftPackageProductDependency;
productName = Analytics;
};
7717A84C28BBB89700C449CC /* ThirdPartyLibraryManager */ = {
isa = XCSwiftPackageProductDependency;
productName = ThirdPartyLibraryManager;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 777C665528A74A62000BECEA /* Project object */;
}
8 changes: 8 additions & 0 deletions Hous-iOS-release/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@
//

import UIKit
import Analytics

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

AppLogService.Firebase.configure()
AppLogService.Firebase.logEvent(
event: .appStart,
parameter: [:]
)

return true
}

Expand Down
2 changes: 0 additions & 2 deletions Hous-iOS-release/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
let window = UIWindow(windowScene: windowScene)
Expand Down
58 changes: 56 additions & 2 deletions Hous-iOS-release/Scene/Splash/SplashViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,65 @@

import UIKit

import RxCocoa
import Alamofire
import RxSwift



protocol ViewModelType {
associatedtype Input
associatedtype Output
func transform(input: Input) -> Output
}

struct TestViewModel: ViewModelType {
struct Input {
let viewWillAppear: Observable<Void>
}
struct Output {
let result: Observable<[Int]>
}

func transform(input: Input) -> Output {

let result = input.viewWillAppear
.map { _ in [3,4,5,6,7,8] }
.asObservable()


return Output(result: result)
}
}




final class SplashViewController: UIViewController {
private let viewModel = TestViewModel()

private let disposeBag = DisposeBag()

override func viewDidLoad() {
super.viewDidLoad()
bind()
}

private func bind() {
let viewWillAppear = rx.sentMessage(#selector(UIViewController.viewWillAppear(_:)))
.map {_ in () }
.asObservable()

let input = TestViewModel.Input(viewWillAppear: viewWillAppear)

let output = viewModel.transform(input: input)


output.result
.subscribe(onNext: { intArray in
print(intArray)
})
.disposed(by: disposeBag)

view.backgroundColor = .red
print("Splash")
}
}
9 changes: 9 additions & 0 deletions Network/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
28 changes: 28 additions & 0 deletions Network/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "Network",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "Network",
targets: ["Network"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "Network",
dependencies: []),
.testTarget(
name: "NetworkTests",
dependencies: ["Network"]),
]
)
3 changes: 3 additions & 0 deletions Network/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Network

A description of this package.
6 changes: 6 additions & 0 deletions Network/Sources/Network/Network.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public struct Network {
public private(set) var text = "Hello, World!"

public init() {
}
}
11 changes: 11 additions & 0 deletions Network/Tests/NetworkTests/NetworkTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import XCTest
@testable import Network

final class NetworkTests: XCTestCase {
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
XCTAssertEqual(Network().text, "Hello, World!")
}
}
9 changes: 9 additions & 0 deletions ThirdPartyLibraryManager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
23 changes: 23 additions & 0 deletions ThirdPartyLibraryManager/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"pins" : [
{
"identity" : "alamofire",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Alamofire/Alamofire.git",
"state" : {
"revision" : "354dda32d89fc8cd4f5c46487f64957d355f53d8",
"version" : "5.6.1"
}
},
{
"identity" : "rxswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ReactiveX/RxSwift.git",
"state" : {
"revision" : "b4307ba0b6425c0ba4178e138799946c3da594f8",
"version" : "6.5.0"
}
}
],
"version" : 2
}
66 changes: 66 additions & 0 deletions ThirdPartyLibraryManager/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

import PackageDescription

let package = Package(
name: "ThirdPartyLibraryManager",
platforms: [
.iOS(.v15),
],
products: [
.library(
name: "ThirdPartyLibraryManager",
targets: ["ThirdPartyLibraryManager"]),
.library(name: "Analytics", targets: ["Analytics"]),
],
dependencies: [
.package(url: "https://github.com/Alamofire/Alamofire.git", exact: "5.6.1"),
.package(url: "https://github.com/ReactiveX/RxSwift.git", exact: "6.5.0"),
],
targets: [
.target(
name: "ThirdPartyLibraryManager",
dependencies: [
"Alamofire",
.product(name: "RxSwift", package: "Rxswift"),
.product(name: "RxCocoa", package: "Rxswift"),
]
),
.binaryTarget(name: "FBLPromises", path: "./Vender/FirebaseAnalytics/FBLPromises.xcframework"),
.binaryTarget(name: "FirebaseAnalytics", path: "./Vender/FirebaseAnalytics/FirebaseAnalytics.xcframework"),
.binaryTarget(name: "FirebaseAnalyticsSwift", path: "./Vender/FirebaseAnalytics/FirebaseAnalyticsSwift.xcframework"),
.binaryTarget(name: "FirebaseCore", path: "./Vender/FirebaseAnalytics/FirebaseCore.xcframework"),
.binaryTarget(name: "FirebaseCoreDiagnostics", path: "./Vender/FirebaseAnalytics/FirebaseCoreDiagnostics.xcframework"),
.binaryTarget(name: "FirebaseCoreInternal", path: "./Vender/FirebaseAnalytics/FirebaseCoreInternal.xcframework"),
.binaryTarget(name: "FirebaseInstallations", path: "./Vender/FirebaseAnalytics/FirebaseInstallations.xcframework"),
.binaryTarget(name: "GoogleAppMeasurement", path: "./Vender/FirebaseAnalytics/GoogleAppMeasurement.xcframework"),
.binaryTarget(name: "GoogleAppMeasurementIdentitySupport", path: "./Vender/FirebaseAnalytics/GoogleAppMeasurementIdentitySupport.xcframework"),
.binaryTarget(name: "GoogleDataTransport", path: "./Vender/FirebaseAnalytics/GoogleDataTransport.xcframework"),
.binaryTarget(name: "GoogleUtilities", path: "./Vender/FirebaseAnalytics/GoogleUtilities.xcframework"),
.binaryTarget(name: "nanopb", path: "./Vender/FirebaseAnalytics/nanopb.xcframework"),

.target(
name: "Analytics",
dependencies: [
.target(name: "FBLPromises"),
.target(name: "FirebaseAnalytics"),
.target(name: "FirebaseAnalyticsSwift"),
.target(name: "FirebaseCore"),
.target(name: "FirebaseCoreDiagnostics"),
.target(name: "FirebaseCoreInternal"),
.target(name: "FirebaseInstallations"),
.target(name: "GoogleAppMeasurement"),
.target(name: "GoogleAppMeasurementIdentitySupport"),
.target(name: "GoogleDataTransport"),
.target(name: "GoogleUtilities"),
.target(name: "nanopb")
],
resources: [
.process("Resource")
]
)
]
)
3 changes: 3 additions & 0 deletions ThirdPartyLibraryManager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ThirdPartyLibraryManager

A description of this package.
28 changes: 28 additions & 0 deletions ThirdPartyLibraryManager/Sources/Analytics/AppLogEvent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// File.swift
//
//
// Created by 김호세 on 2022/08/28.
//

import Foundation

public enum AppLogEvent: String {
case appStart
case didTapButton
}

extension AppLogEvent {
public var rawValue: String {
switch self {
case .appStart: return "AppStart"
case .didTapButton: return "didTapButton"
}
}
}

public enum AppLogEventAttribute: String {
case itemID = "itemID"
case itemName = "itemName"
case contentType = "contentType"
}
11 changes: 11 additions & 0 deletions ThirdPartyLibraryManager/Sources/Analytics/AppLogService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// File.swift
//
//
// Created by 김호세 on 2022/08/28.
//

import Foundation
import FirebaseAnalytics

public class AppLogService { }
Loading

0 comments on commit 7b10048

Please sign in to comment.