Skip to content

Conversation

@stalkermv
Copy link
Owner

No description provided.

@stalkermv stalkermv requested a review from Copilot May 8, 2025 18:25
@stalkermv stalkermv self-assigned this May 8, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces new SwiftUI extension utilities and improvements for view modifiers, bindings, and color utilities in the SwiftUIHelpers library.

  • Adds view modifiers for hit testing and hiding views.
  • Provides additional extensions for fonts, colors, edge insets, content size categories, and bindings.
  • Updates Package.swift and CI workflows to support newer Swift and platform versions.

Reviewed Changes

Copilot reviewed 70 out of 70 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Sources/SwiftUIExtensions/View+HitTestAreaPadding.swift Adds padding modifications for hit test areas.
Sources/SwiftUIExtensions/View+Hidden.swift Introduces a hidden view modifier with an option to remove the view.
Sources/SwiftUIExtensions/View+EmbedInNavigation.swift Provides a function to embed Views in a NavigationStack.
Sources/SwiftUIExtensions/UIColor+ColorScheme.swift Implements dynamic color support for light/dark mode.
Sources/SwiftUIExtensions/Image+Resizable.swift Adds resizable image extension with content mode handling.
Sources/SwiftUIExtensions/Font/*.swift Maps Font designs, weights, and text styles to UIKit counterparts.
Sources/SwiftUIExtensions/Environment+IsPreview.swift Detects SwiftUI previews via environment values.
Sources/SwiftUIExtensions/EdgeInsets+Init.swift Adds a convenient initializer for symmetrical insets.
Sources/SwiftUIExtensions/DynamicTypeSize+ContentSizeCategory.swift Provides interoperability between DynamicTypeSize and ContentSizeCategory.
Sources/SwiftUIExtensions/Color+Random.swift Adds a random color generator.
Sources/SwiftUIExtensions/Color+AccessibleFontColor.swift Adjusts font colors for accessibility contrast.
Sources/SwiftUIExtensions/Binding.swift & Binding+*.swift Extend binding functionalities with several utility methods.
Package.swift Upgrades Swift tools version and updates platforms/dependencies.
.github/workflows/tests.yml Configures the CI workflow for building and testing the project.


public func body(content: Content) -> some View {
if isHidden {
if !remove {
Copy link

Copilot AI May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When 'isHidden' is true and 'remove' is also true, no view is returned from the body, leading to a missing view branch. Consider returning an EmptyView() in this case to maintain a consistent return type.

Suggested change
if !remove {
if remove {
EmptyView()
} else {

Copilot uses AI. Check for mistakes.
@stalkermv stalkermv requested a review from Copilot May 12, 2025 15:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates and extends the SwiftUIHelpers library by adding several new view modifiers, extensions for UIKit interoperability, and binding utilities while also updating package configuration and CI.

  • Introduces new view modifiers such as hit test area padding, hidden view handling, and navigation embedding.
  • Adds extensions for UIColor, Image, Font, Environment, EdgeInsets, DynamicTypeSize, and Color to improve UI customization and interoperability.
  • Implements new Binding utilities and updates Package.swift and GitHub Actions CI workflow for builds and tests.

Reviewed Changes

Copilot reviewed 86 out of 86 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Sources/SwiftUIExtensions/View+HitTestAreaPadding.swift Adds hit test area padding modifier with a negative padding hack for extended touch areas.
Sources/SwiftUIExtensions/View+Hidden.swift Implements a view extension to hide or completely remove a view using a custom modifier.
Sources/SwiftUIExtensions/View+EmbedInNavigation.swift Provides a helper method to embed views in a NavigationStack with configurable title display modes.
Sources/SwiftUIExtensions/UIColor+ColorScheme.swift Introduces dynamic UIColor initializer to support light/dark mode.
Sources/SwiftUIExtensions/Image+Resizable.swift Adds a convenient resizable image helper that adapts aspect ratio based on content mode.
Sources/SwiftUIExtensions/Font/UIFontDescriptor.SystemDesign+Font.Design.swift Maps Font.Design to corresponding UIFontDescriptor.SystemDesign values.
Sources/SwiftUIExtensions/Font/UIFont.Weight+Font.Weight.swift Maps Font.Weight to UIFont.Weight with a fallback using rawValue mapping for custom cases.
Sources/SwiftUIExtensions/Font/UIFont.TextStyle+Font.TextStyle.swift Maps Font.TextStyle to UIKit text styles.
Sources/SwiftUIExtensions/Environment+IsPreview.swift Provides an Environment value and helper view for detecting SwiftUI previews.
Sources/SwiftUIExtensions/EdgeInsets+Init.swift Offers an initializer for EdgeInsets to construct symmetrical insets easily.
Sources/SwiftUIExtensions/DynamicTypeSize+ContentSizeCategory.swift Converts DynamicTypeSize to a corresponding ContentSizeCategory with a default fallback.
Sources/SwiftUIExtensions/Color+Random.swift Adds a static property to generate random colors.
Sources/SwiftUIExtensions/Color+AccessibleFontColor.swift Implements a method to determine a contrasting font color based on the background color.
Sources/SwiftUIExtensions/Binding.swift Enhances Binding to select an identifiable element from a collection.
Sources/SwiftUIExtensions/Binding+Equals.swift Introduces a boolean binding initializer that reflects equality to a given value.
Sources/SwiftUIExtensions/Binding+Boolean.swift Adds a computed binding property to represent the presence or absence of a value as a boolean.
Sources/SwiftUIExtensions/Binding+??.swift Overloads the nil coalescing operator for Bindings to provide a non-optional view.
Package.swift Updates swift-tools version, platform requirements, and dependencies for enhanced compatibility.
.github/workflows/tests.yml Adds a CI workflow to build and test the Swift project using the latest Xcode version.
Comments suppressed due to low confidence (1)

Sources/SwiftUIExtensions/Binding+??.swift:2

  • [nitpick] The filename 'Binding+??.swift' is ambiguous and may lead to confusion. Renaming the file to something like 'Binding+NilCoalescing.swift' would improve clarity.
//  Binding+??.swift


public func body(content: Content) -> some View {
if isHidden {
if !remove {
Copy link

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When isHidden is true and remove is true, no view is returned, which breaks the view hierarchy. Consider returning an EmptyView() or a similar placeholder in this branch to ensure a valid view is always provided.

Suggested change
if !remove {
if remove {
EmptyView()
} else {

Copilot uses AI. Check for mistakes.
@stalkermv stalkermv merged commit 5a1b713 into main May 12, 2025
1 check passed
@stalkermv stalkermv deleted the development branch May 12, 2025 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant