Skip to content

Conversation

@dima6312
Copy link
Owner

@dima6312 dima6312 commented Dec 29, 2025

Summary

  • Make disableCompactLeading and disableCompactTrailing properties public so developers can dynamically hide compact views on DynamicNotch instances
  • Fix floating mode layout to use conditional rendering instead of opacity - disabled views no longer reserve space
  • Use HStack(spacing: 12) for cleaner layout when views are conditionally removed

Value

Audience Before After
Developers Could only disable via DynamicNotchInfo.compactLeading = nil Can now directly set dynamicNotch.disableCompactLeading = true
End Users (floating mode) Disabled icon left a gap No gap - cleaner layout

Breaking Changes

None - existing DynamicNotchInfo API continues to work unchanged.

Test plan

  • All 19 existing tests pass
  • "Info - Advanced" tests cover enable/disable compact content flow
  • Verified both notch and floating styles

🤖 Generated with Claude Code


Summary by cubic

Expose disableCompactLeading and disableCompactTrailing as public flags to let apps hide compact indicators at runtime. Fix floating mode layout so disabled icons don’t leave gaps.

  • New Features

    • Public @published flags: disableCompactLeading and disableCompactTrailing on DynamicNotch.
  • Bug Fixes

    • Floating mode now conditionally renders compact views; hidden views don’t reserve space.
    • Use HStack(spacing: 12) for cleaner gaps when items are hidden.

Written for commit 5a8d600. Summary will update automatically on new commits.

- Make disableCompactLeading and disableCompactTrailing properties public
  so developers can dynamically hide compact views on DynamicNotch instances
- Fix floating mode (NotchlessView) to use conditional rendering instead of
  opacity, ensuring disabled views don't reserve space
- Use HStack spacing for cleaner layout when views are conditionally removed

No breaking changes - existing DynamicNotchInfo API continues to work unchanged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Dec 29, 2025

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features
    • Introduced public configuration options to control the visibility of compact leading and trailing content in notch displays, providing greater UI customization flexibility.
    • Optimized spacing between notch elements for improved visual presentation and better element separation in layouts.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

This change exposes two internal visibility flags (disableCompactLeading and disableCompactTrailing) as public properties on DynamicNotch and updates NotchlessView to conditionally render leading/trailing compact content based on these flags rather than always rendering with opacity-based hiding, aligning behavior with NotchView.

Changes

Cohort / File(s) Summary
State Management
Sources/DynamicNotchKit/DynamicNotch/DynamicNotch.swift
Added public modifier and documentation comments to disableCompactLeading and disableCompactTrailing properties, exposing previously internal visibility flags for controlling compact content rendering.
View Rendering
Sources/DynamicNotchKit/Views/NotchlessView.swift
Implemented conditional rendering of leading/trailing compact content based on disableCompactLeading/disableCompactTrailing flags; adjusted HStack spacing from 0 to 12 for automatic gaps between visible elements.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: expose disableCompactLeading/Trailing as public API' directly and specifically describes the main change—making these properties public, which is the primary focus of the PR.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, covering the purpose, value, breaking changes, and test plan for the exposed public properties and layout fixes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/public-disable-compact-views

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b351057 and 5a8d600.

📒 Files selected for processing (2)
  • Sources/DynamicNotchKit/DynamicNotch/DynamicNotch.swift
  • Sources/DynamicNotchKit/Views/NotchlessView.swift
🔇 Additional comments (2)
Sources/DynamicNotchKit/DynamicNotch/DynamicNotch.swift (1)

77-81: LGTM! Clean public API exposure with clear documentation.

The properties are well-documented, default to false for backward compatibility, and use @Published to ensure reactive updates. The documentation accurately describes the behavior ("removes from layout"), which is correctly implemented in NotchlessView.swift.

Sources/DynamicNotchKit/Views/NotchlessView.swift (1)

85-103: LGTM! Conditional rendering correctly implements the documented behavior.

The changes properly implement "removes from layout" by using conditional rendering instead of opacity-based hiding. The HStack(spacing: 12) provides clean automatic gaps when elements are disabled, which aligns with the PR objective of producing cleaner layouts in floating mode.

The implementation is consistent between leading and trailing content and matches the approach described for NotchView.swift.


Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @dima6312, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the DynamicNotch component by providing developers with direct programmatic control over the visibility of compact leading and trailing content. It also refines the rendering logic for the floating mode, transitioning from opacity-based hiding to conditional rendering. This change eliminates unwanted gaps when compact views are disabled, leading to a more visually consistent and cleaner user interface for end-users, while offering greater flexibility for developers.

Highlights

  • Public API Exposure: The disableCompactLeading and disableCompactTrailing properties on DynamicNotch instances have been made public, allowing developers to dynamically control the visibility of compact views.
  • Floating Mode Layout Fix: The layout in floating mode now uses conditional rendering instead of opacity to hide disabled compact views, ensuring that disabled views no longer reserve space and result in a cleaner layout.
  • Improved Layout Spacing: The HStack used for compact indicators in NotchlessView now utilizes spacing: 12 for cleaner and more automatic spacing between conditionally rendered elements.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully exposes disableCompactLeading and disableCompactTrailing as public properties, allowing for dynamic control over compact view visibility. The accompanying refactoring in NotchlessView to use conditional rendering instead of opacity is a significant improvement, as it prevents disabled views from reserving layout space and simplifies the view hierarchy. The code changes are clean and well-executed. I have a minor suggestion to improve the conciseness of the .frame modifiers.

if !dynamicNotch.disableCompactLeading {
dynamicNotch.compactLeadingContent
.environment(\.notchSection, .compactLeading)
.frame(minWidth: compactIconSize, minHeight: compactIconSize, maxHeight: compactIconSize)

Choose a reason for hiding this comment

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

medium

For improved conciseness, you can use the height parameter in the .frame modifier since minHeight and maxHeight are set to the same value (compactIconSize).

Suggested change
.frame(minWidth: compactIconSize, minHeight: compactIconSize, maxHeight: compactIconSize)
.frame(minWidth: compactIconSize, height: compactIconSize)

Copy link
Owner Author

Choose a reason for hiding this comment

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

The logic is correct: When minHeight == maxHeight, using height: is cleaner.

But SwiftUI's API doesn't allow it: SwiftUI has two separate .frame() overloads:

  1. .frame(width:height:alignment:)
  2. .frame(minWidth:idealWidth:maxWidth:minHeight:idealHeight:maxHeight:alignment:)

You can't mix minWidth: (from overload 2) with height: (from overload 1) in the same call.

if !dynamicNotch.disableCompactTrailing {
dynamicNotch.compactTrailingContent
.environment(\.notchSection, .compactTrailing)
.frame(minWidth: compactIconSize, minHeight: compactIconSize, maxHeight: compactIconSize)

Choose a reason for hiding this comment

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

medium

For improved conciseness, you can use the height parameter in the .frame modifier since minHeight and maxHeight are set to the same value (compactIconSize).

Suggested change
.frame(minWidth: compactIconSize, minHeight: compactIconSize, maxHeight: compactIconSize)
.frame(minWidth: compactIconSize, height: compactIconSize)

Copy link
Owner Author

Choose a reason for hiding this comment

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

Gemini's suggestion was incorrect - SwiftUI doesn't have a .frame(minWidth:height:) overload. The original code is correct.

@dima6312 dima6312 merged commit b1fa8a3 into main Dec 29, 2025
2 checks passed
@dima6312 dima6312 deleted the feature/public-disable-compact-views branch December 29, 2025 17:11
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.

2 participants