Skip to content

Commit

Permalink
Update images
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Dec 13, 2024
1 parent 703fff7 commit 8ea7bb8
Show file tree
Hide file tree
Showing 19 changed files with 245 additions and 109 deletions.
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
--swiftversion 5.9
--swiftversion 6.0
--disable preferKeyPath
--ifdef no-indent
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ let package = Package(
.macOS(.v13),
.tvOS(.v15),
.watchOS(.v9),
.visionOS(.v2),
],
products: [
.library(
Expand Down
5 changes: 2 additions & 3 deletions Sources/OversizeUI/Controls/PageView/Page.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ public struct Page<Content, Header, LeadingBar, TrailingBar, TopToolbar, TitleLa
.toolbarBackground(.hidden)
.toolbar(isFocusSearchBar ? .hidden : .automatic, for: .navigationBar)
.navigationBarTitleDisplayMode(.inline)
#endif
#if os(macOS)
.navigationTitle(title ?? "")
#elseif os(macOS)
.navigationTitle(title ?? "")
#endif
}

Expand Down
31 changes: 20 additions & 11 deletions Sources/OversizeUI/Controls/SegmentedControl/SegmentedControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public struct SegmentedPickerSelector<Element: Equatable, Content, Selection>: V
@Environment(\.segmentedControlStyle) private var style
@Environment(\.controlRadius) var controlRadius: Radius
@Environment(\.segmentedPickerMargins) var controlPadding: EdgeSpaceInsets
@Environment(\.platform) var platform: Platform

public typealias Data = [Element]

Expand Down Expand Up @@ -224,7 +225,8 @@ public struct SegmentedPickerSelector<Element: Equatable, Content, Selection>: V
? Color.border
: Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize))
)
.shadowElevaton(.z2)
.shadowElevaton(platform == .macOS ? .z0 : .z2)

case .graySurface:

if style.unseletionStyle == .clean {
Expand All @@ -246,6 +248,7 @@ public struct SegmentedPickerSelector<Element: Equatable, Content, Selection>: V
style: .continuous)
.strokeBorder(Color.onSurfaceSecondary, lineWidth: 2)
}

case .accentSurface:
RoundedRectangle(
cornerRadius: style.isShowBackground ? controlRadius.rawValue - 4 : controlRadius.rawValue,
Expand All @@ -261,17 +264,23 @@ public struct SegmentedPickerSelector<Element: Equatable, Content, Selection>: V
case .clean:
EmptyView()
case .surface:

RoundedRectangle(cornerRadius: controlRadius,
style: .continuous)
.fill(Color.surfaceSecondary)
.overlay(
RoundedRectangle(cornerRadius: controlRadius,
style: .continuous)
.stroke(theme.borderControls
? Color.border
: Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize))
RoundedRectangle(
cornerRadius: controlRadius,
style: .continuous
)
.fill(Color.surfaceSecondary)
.overlay(
RoundedRectangle(
cornerRadius: controlRadius,
style: .continuous
)
.stroke(
theme.borderControls
? Color.border
: Color.surfaceSecondary,
lineWidth: CGFloat(theme.borderSize)
)
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public struct LabeledTextFieldStyle: TextFieldStyle {

private var fieldRadius: Radius {
#if os(macOS)
return .xSmall
return .small
#else
return .medium
#endif
Expand Down
4 changes: 2 additions & 2 deletions Sources/OversizeUI/Core/Appearance/ThemeSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public class ThemeSettings: ObservableObject, @unchecked Sendable {
@AppStorage(ThemeSettingsNames.borderTextFields) public var borderTextFields: Bool = true
@AppStorage(ThemeSettingsNames.borderSurface) public var borderSurface: Bool = true
@AppStorage(ThemeSettingsNames.radius) public var radius: Double = 4
@AppStorage(ThemeSettingsNames.borderControls) public var borderControls: Bool = true
#else
@AppStorage(ThemeSettingsNames.borderSurface) public var borderSurface: Bool = false
@AppStorage(ThemeSettingsNames.borderTextFields) public var borderTextFields: Bool = false
@AppStorage(ThemeSettingsNames.borderSize) public var borderSize: Double = 0.5
@AppStorage(ThemeSettingsNames.radius) public var radius: Double = 8
#endif

@AppStorage(ThemeSettingsNames.borderControls) public var borderControls: Bool = false
#endif

@AppStorage(ThemeSettingsNames.theme) public var theme: Int = 0

Expand Down
19 changes: 19 additions & 0 deletions Sources/OversizeUI/Core/Illustrations.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// Copyright © 2024 Alexander Romanov
// Illustration.swift, created on 16.11.2024
//

import SwiftUI

public extension SwiftUI.Image {
enum Illustration {
public enum Status {
public static let success = Image("Status/Success", bundle: .module)
public static let error = Image("Status/Error", bundle: .module)
public static let warning = Image("Status/Warning", bundle: .module)
public enum Warning {
public static let fill = Image("Status/Warning/Triangle", bundle: .module)
}
}
}
}
32 changes: 32 additions & 0 deletions Sources/OversizeUI/Core/ViewModifier/DelayTask/DelayTask.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// Copyright © 2024 Alexander Romanov
// DelayTaskViewModifier.swift, created on 13.11.2024
//

import SwiftUI

@available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 13.0, *)
struct DelayTaskViewModifier: ViewModifier {
let delay: ContinuousClock.Instant.Duration
let action: @Sendable () async -> Void

func body(content: Content) -> some View {
content
.task {
do {
try await Task.sleep(for: delay)
await action()
} catch {}
}
}
}

@available(iOS 16.0, tvOS 16.0, watchOS 9.0, macOS 13.0, *)
public extension View {
func task(
delay: ContinuousClock.Duration,
action: @Sendable @escaping () async -> Void
) -> some View {
modifier(DelayTaskViewModifier(delay: delay, action: action))
}
}
24 changes: 16 additions & 8 deletions Sources/OversizeUI/Deprecated/Icon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
import SwiftUI

public enum IconSizes: CaseIterable {
case xSmall
case small
case medium
case large
case xLarge

public var rawValue: CGFloat {
switch self {
case .xSmall:
Space.xSmall.rawValue
case .small:
Space.small.rawValue
case .medium:
Expand All @@ -32,6 +35,7 @@ public enum IconSizes: CaseIterable {
public struct IconDeprecated: View {
private enum Constants: Sendable {
/// Size
static let xSmall: CGFloat = Space.xSmall.rawValue
static let small: CGFloat = Space.small.rawValue
static let medium: CGFloat = Space.medium.rawValue
static let large: CGFloat = Space.large.rawValue
Expand Down Expand Up @@ -74,10 +78,12 @@ public struct IconDeprecated: View {

private var iconSize: CGFloat {
switch size {
case .medium:
Constants.medium
case .xSmall:
Constants.xSmall
case .small:
Constants.small
case .medium:
Constants.medium
case .large:
Constants.large
case .xLarge:
Expand All @@ -95,12 +101,14 @@ public struct IconDeprecated: View {
@available(tvOS, unavailable)
struct IconAsset_Previews: PreviewProvider {
static var previews: some View {
let grid = [GridItem(),
GridItem(),
GridItem(),
GridItem(),
GridItem(),
GridItem()]
let grid = [
GridItem(),
GridItem(),
GridItem(),
GridItem(),
GridItem(),
GridItem(),
]

Button(role: .cancel, action: {}, label: {
Text("Text")
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeUI/Extensions/View/View+SizeReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import SwiftUI

public extension View {
func readSize(onChange: @escaping (CGSize) -> Void) -> some View {
func readSize(onChange: @Sendable @escaping (CGSize) -> Void) -> some View {
background(
GeometryReader { geometryProxy in
Color.clear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.404",
"green" : "0.831",
"red" : "0.333"
"blue" : "0x5E",
"green" : "0xB3",
"red" : "0x5C"
}
},
"idiom" : "universal"
Expand All @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.294",
"green" : "0.745",
"red" : "0.220"
"blue" : "0x4B",
"green" : "0x99",
"red" : "0x4B"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8ea7bb8

Please sign in to comment.