Skip to content

Commit 8709778

Browse files
authored
feat: Refine publicly exposed types (#1)
1 parent 3b1f08a commit 8709778

File tree

6 files changed

+23
-5
lines changed

6 files changed

+23
-5
lines changed

.github/workflows/documentation.yml

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
uses: jdx/mise-action@v2
2727
with:
2828
install: true
29+
env:
30+
MISE_HTTP_TIMEOUT: 300
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2932

3033
- name: Checkout gh-pages Branch
3134
uses: actions/checkout@v4

.github/workflows/test.yml

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
uses: jdx/mise-action@v2
2727
with:
2828
install: true
29+
env:
30+
MISE_HTTP_TIMEOUT: 300
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2932

3033
- name: Test iOS
3134
run: >

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
1. [Installation](#installation)
1212
2. [Basic Usage](#basic-usage)
13-
3. [Making Your App Themeable](#make-your-app-themeable)
13+
3. [Make Your App Themeable](#make-your-app-themeable)
1414
4. [Documentation](#documentation)
1515
5. [License](#license)
1616

Sources/Documentation.docc/Articles/GettingStarted.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let package = Package(
99
dependencies: [
1010
.package(
1111
url: "https://github.com/alexanderwe/swiftui-theming",
12-
from: "0.1.0"
12+
from: "0.1.1"
1313
),
1414
],
1515
targets: [

Sources/Theming/Theme.swift

+12
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,22 @@ public struct Theme: Sendable, Identifiable {
8383
}
8484

8585
// MARK: - Methods
86+
87+
/// Get a color for the requested color style and traits.
88+
///
89+
/// - Parameters:
90+
/// - style: The style to resolve a color for.
91+
/// - traits: The traits used to resolve the color.
92+
/// - Returns: A color for the given parameters. Returns nil if no matching color is found.
8693
func color(for style: ThemeColorStyle, with traits: ThemeTraits) -> Color? {
8794
colors[style]?.resolve(with: traits)
8895
}
8996

97+
/// Get a font for the requested style.
98+
///
99+
/// - Parameters:
100+
/// - style: The style to resolve a font for.
101+
/// - Returns: A font for the given parameters. Returns nil if no matching font is found.
90102
func font(for style: Font.TextStyle) -> Font? {
91103
fonts[style]
92104
}

Sources/Theming/ThemeTraits.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ import SwiftUI
1010
import UIKit
1111
#endif
1212

13-
// MARK: - ThemeColorTraits
13+
// MARK: - ThemeTraits
1414
#if os(visionOS) || os(iOS)
1515
/// Traits important for a theme.
16-
public typealias ThemeTraits = (
16+
typealias ThemeTraits = (
1717
colorScheme: ColorScheme,
1818
colorSchemeContrast: ColorSchemeContrast,
1919
interfaceLevel: UIUserInterfaceLevel
2020
)
2121
#elseif os(watchOS) || os(tvOS) || os(macOS)
2222
/// Traits important for a theme.
23-
public typealias ThemeTraits = (colorScheme: ColorScheme, colorSchemeContrast: ColorSchemeContrast)
23+
typealias ThemeTraits = (colorScheme: ColorScheme, colorSchemeContrast: ColorSchemeContrast)
2424
#endif
2525

2626
extension EnvironmentValues {

0 commit comments

Comments
 (0)