-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee02f57
commit 84eb77c
Showing
5 changed files
with
71 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
Projects/CoreKit/Sources/Data/Client/DeviceClient/DeviceClient+LiveKey.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// DeviceClient+LiveKey.swift | ||
// CoreKit | ||
// | ||
// Created by ๊น๋ํ on 10/25/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
import Dependencies | ||
|
||
extension DeviceClient: DependencyKey { | ||
public static let liveValue: Self = { | ||
#if os(iOS) | ||
let device = UIDevice.current.userInterfaceIdiom | ||
#endif | ||
|
||
return Self( | ||
isPhone: { | ||
#if os(macOS) | ||
return false | ||
#endif | ||
return device == .phone | ||
}, | ||
isPad: { | ||
#if os(macOS) | ||
return false | ||
#endif | ||
return device == .pad | ||
}, | ||
isMac: { | ||
#if os(macOS) | ||
return true | ||
#endif | ||
return false | ||
} | ||
) | ||
}() | ||
} |
16 changes: 16 additions & 0 deletions
16
Projects/CoreKit/Sources/Data/Client/DeviceClient/DeviceClient.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// DeviceClient.swift | ||
// CoreKit | ||
// | ||
// Created by ๊น๋ํ on 10/25/24. | ||
// | ||
|
||
import Foundation | ||
import DependenciesMacros | ||
|
||
@DependencyClient | ||
public struct DeviceClient: Sendable { | ||
public var isPhone: @Sendable () -> Bool = { false } | ||
public var isPad: @Sendable () -> Bool = { false } | ||
public var isMac: @Sendable () -> Bool = { false } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.