diff --git a/SimpleKeychain/SimpleKeychain.swift b/SimpleKeychain/SimpleKeychain.swift index 24191d5..50ba359 100644 --- a/SimpleKeychain/SimpleKeychain.swift +++ b/SimpleKeychain/SimpleKeychain.swift @@ -35,7 +35,7 @@ public struct SimpleKeychain: @unchecked Sendable { /// - Parameter synchronizable: Whether the items should be synchronized through iCloud. Defaults to `false`. /// - Parameter attributes: Additional attributes to include in every query. Defaults to an empty dictionary. /// - Returns: A ``SimpleKeychain`` instance. - public init(service: String = Bundle.main.bundleIdentifier!, + public init(service: String = Bundle.main.bundleIdentifier ?? "SimpleKeychain", accessGroup: String? = nil, accessibility: Accessibility = .afterFirstUnlock, accessControlFlags: SecAccessControlCreateFlags? = nil, @@ -61,7 +61,7 @@ public struct SimpleKeychain: @unchecked Sendable { /// - Parameter synchronizable: Whether the items should be synchronized through iCloud. Defaults to `false`. /// - Parameter attributes: Additional attributes to include in every query. Defaults to an empty dictionary. /// - Returns: A ``SimpleKeychain`` instance. - public init(service: String = Bundle.main.bundleIdentifier!, + public init(service: String = Bundle.main.bundleIdentifier ?? "SimpleKeychain", accessGroup: String? = nil, accessibility: Accessibility = .afterFirstUnlock, accessControlFlags: SecAccessControlCreateFlags? = nil, diff --git a/SimpleKeychainTests/SimpleKeychainSpec.swift b/SimpleKeychainTests/SimpleKeychainSpec.swift index c167430..9bca9a8 100644 --- a/SimpleKeychainTests/SimpleKeychainSpec.swift +++ b/SimpleKeychainTests/SimpleKeychainSpec.swift @@ -23,7 +23,7 @@ class SimpleKeychainTests: XCTestCase { func testInitializationWithDefaultValues() { XCTAssertEqual(sut.accessGroup, nil) - XCTAssertEqual(sut.service, Bundle.main.bundleIdentifier) + XCTAssertEqual(sut.service, Bundle.main.bundleIdentifier ?? "SimpleKeychain") XCTAssertEqual(sut.accessibility, Accessibility.afterFirstUnlock) XCTAssertEqual(sut.accessControlFlags, nil) XCTAssertEqual(sut.isSynchronizable, false) @@ -374,4 +374,3 @@ public extension Dictionary where Key == String, Value == Any { public func ==(lhs: [String: Any], rhs: [String: Any]) -> Bool { return NSDictionary(dictionary: lhs).isEqual(to: rhs) } -