Skip to content

Commit 2786deb

Browse files
authored
Fix resource loading in GoogleSignInSwift with CocoaPods use_frameworks! (#197)
1 parent ab78228 commit 2786deb

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

GoogleSignInSwift/Sources/GoogleSignInButtonBundleExtensions.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#if !arch(arm) && !arch(i386)
1818

1919
import Foundation
20+
import GoogleSignIn
2021

2122
// MARK: - Bundle Extensions
2223

@@ -40,7 +41,7 @@ extension Bundle {
4041
return Bundle(path: mainPath)
4142
}
4243

43-
let classBundle = Bundle(for: GoogleSignInButtonViewModel.self)
44+
let classBundle = Bundle(for: GIDSignIn.self)
4445

4546
if let classPath = classBundle.path(
4647
forResource: GoogleSignInBundleName,
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import XCTest
18+
import SwiftUI
19+
@testable import GoogleSignInSwift
20+
21+
@available(iOS 13.0, macOS 10.15, *)
22+
class GoogleSignInButtonExtensionsTests: XCTestCase {
23+
24+
func testThatBundleExtensionReturnsImageIconURL() {
25+
let googleIcon = Bundle.urlForGoogleResource(name: googleImageName, withExtension: "png")
26+
XCTAssertNotNil(googleIcon)
27+
}
28+
29+
func testThatBundleExtensionReturnsFontURL() {
30+
let googleFont = Bundle.urlForGoogleResource(name: fontNameRobotoBold, withExtension: "ttf")
31+
XCTAssertNotNil(googleFont)
32+
}
33+
34+
}

0 commit comments

Comments
 (0)