Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Example/ExampleTests/ExampleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class ExampleTests: XCTestCase {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}

func testExample() throws {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}

func testPerformanceExample() throws {
func testPerformanceExample() {
// This is an example of a performance test case.
measure {
// Put the code you want to measure the time of here.
Expand Down
4 changes: 2 additions & 2 deletions Example/ExampleUITests/ExampleUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ExampleUITests: XCTestCase {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}

func testExample() throws {
func testExample() {
// UI tests must launch the application that they test.
let app: XCUIApplication = .init()
app.launch()
Expand All @@ -29,7 +29,7 @@ class ExampleUITests: XCTestCase {
// Use XCTAssert and related functions to verify your tests produce the correct results.
}

func testLaunchPerformance() throws {
func testLaunchPerformance() {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
Expand Down
1 change: 0 additions & 1 deletion Sources/OversizeUI/Controls/Avatar/Avatar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ public struct Avatar: View {
}

@available(tvOS, unavailable)
@ViewBuilder
private var avatarLabel: some View {
HStack(spacing: avatarTextSpace) {
if let icon {
Expand Down
23 changes: 18 additions & 5 deletions Sources/OversizeUI/Controls/Background/Background.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,26 @@ public enum BackgroundPadding: Int, CaseIterable {
public struct Background<Content: View>: View {
private enum Constants {
/// Colors
static var colorPrimary: Color { Color.backgroundPrimary }
static var colorSecondary: Color { Color.backgroundSecondary }
static var colorTertiary: Color { Color.backgroundTertiary }
static var colorPrimary: Color {
Color.backgroundPrimary
}

static var colorSecondary: Color {
Color.backgroundSecondary
}

static var colorTertiary: Color {
Color.backgroundTertiary
}

/// Size
static var paddingMedium: CGFloat { .medium }
static var paddingSmall: CGFloat { .small }
static var paddingMedium: CGFloat {
.medium
}

static var paddingSmall: CGFloat {
.small
}
}

private let content: Content
Expand Down
3 changes: 0 additions & 3 deletions Sources/OversizeUI/Controls/Badge/Badge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

import SwiftUI

@available(*, deprecated, renamed: "Badge")
public typealias Bage<Label: View> = Badge<Label>

public struct Badge<Label: View>: View {
@Environment(\.theme) private var theme: ThemeSettings
@Environment(\.controlRadius) private var controlRadius
Expand Down
1 change: 0 additions & 1 deletion Sources/OversizeUI/Controls/Checkbox/Checkbox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public struct Checkbox<Label: View>: View {
}
}

@ViewBuilder
private func checkboxImage(isEnabled: Bool, isOn: Bool) -> some View {
ZStack {
RoundedRectangle(cornerRadius: .xxSmall, style: .continuous)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ public struct ColorSelector: View {
}
}
}
}
)
})
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@ public struct DefaultColorSelectorStyle: ColorSelectorStyle {
}
}

struct ColorSelectorStyleStyleKey: EnvironmentKey {
static let defaultValue = AnyColorSelectorStyle(style: DefaultColorSelectorStyle())
}

public extension EnvironmentValues {
var colorSelectorStyle: AnyColorSelectorStyle {
get { self[ColorSelectorStyleStyleKey.self] }
set { self[ColorSelectorStyleStyleKey.self] = newValue }
}
@Entry var colorSelectorStyle: AnyColorSelectorStyle = .init(style: DefaultColorSelectorStyle())
}

public extension View {
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeUI/Controls/ContentView/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import SwiftUI

public struct ContentView<A>: View where A: View {
public struct ContentView<A: View>: View {
@Environment(\.multilineTextAlignment) var multilineTextAlignment

private let image: Image?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public struct ContentViewActionsBuilder {
component
}

public static func buildOptional<Content>(_ content: Content?) -> Content? where Content: View {
public static func buildOptional<Content: View>(_ content: Content?) -> Content? {
content
}

public static func buildIf<Content>(_ content: Content?) -> Content? where Content: View {
public static func buildIf<Content: View>(_ content: Content?) -> Content? {
content
}
}
2 changes: 1 addition & 1 deletion Sources/OversizeUI/Controls/DateField/DateField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import SwiftUI

#if os(iOS)
@available(iOS 16.0, *)
@available(iOS 17.0, *)
@available(macOS, unavailable)
@available(watchOS, unavailable)
@available(tvOS, unavailable)
Expand Down
94 changes: 39 additions & 55 deletions Sources/OversizeUI/Controls/DateField/DatePickerSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import SwiftUI

#if os(iOS)
@available(iOS 17.0, *)
@available(macOS, unavailable)
@available(watchOS, unavailable)
@available(tvOS, unavailable)
Expand Down Expand Up @@ -38,51 +39,8 @@ public struct DatePickerSheet: View {
}

public var body: some View {
if #available(iOS 26.0, *) {
NavigationStack {
LayoutView(title) {
SectionView {
VStack {
if let minimumDate {
DatePicker("", selection: $date, in: minimumDate..., displayedComponents: displayedComponents)
.datePickerStyle(.graphical)
.labelsHidden()
} else {
DatePicker("", selection: $date, displayedComponents: displayedComponents)
.datePickerStyle(.graphical)
.labelsHidden()
}
}
.padding(.horizontal, .small)
.padding(.vertical, .xxxSmall)
}
.surfaceContentMargins(.zero)
} background: {
Color.backgroundSecondary
}
.toolbar {
ToolbarItemGroup(placement: .cancellationAction) {
Button(role: .cancel) {
dismiss()
} label: {
Image.Base.close.icon()
}
}

ToolbarItemGroup(placement: .primaryAction) {
Button(role: .confirm) {
selection = date
optionalSelection = date
dismiss()
} label: {
Text("Done")
}
}
}
.toolbarTitleDisplayMode(.inline)
}
} else {
PageView(title) {
NavigationStack {
LayoutView(title) {
SectionView {
VStack {
if let minimumDate {
Expand All @@ -99,18 +57,44 @@ public struct DatePickerSheet: View {
.padding(.vertical, .xxxSmall)
}
.surfaceContentMargins(.zero)
} background: {
Color.backgroundSecondary
}
.backgroundSecondary()
.leadingBar {
BarButton(.close)
}
.trailingBar {
BarButton(.accent("Done", action: {
selection = date
optionalSelection = date
dismiss()
}))
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button(
"Close",
systemImage: "xmark",
role: .cancel,
action: {
dismiss()
}
)
.labelStyle(.toolbar)
.buttonStyle(.toolbarSecondary)
#if !os(tvOS)
.keyboardShortcut(.cancelAction)
#endif
}

ToolbarItem(placement: .primaryAction) {
Button(
"Done",
systemImage: "checkmark",
action: {
selection = date
optionalSelection = date
dismiss()
}
)
.labelStyle(.toolbar)
.buttonStyle(.toolbarPrimary)
#if !os(tvOS)
.keyboardShortcut(.defaultAction)
#endif
}
}
.toolbarTitleDisplayMode(.inline)
}
}

Expand Down
Loading
Loading