-
Notifications
You must be signed in to change notification settings - Fork 0
[#285] iOS 18에서 adaptiveButtonStyle가 일부 잘려 보이는 현상을 해결한다 #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -93,10 +93,10 @@ private struct ScrollViewOffsetTracker: UIViewRepresentable { | |||||||||||||
|
|
||||||||||||||
| extension View { | ||||||||||||||
| @ViewBuilder | ||||||||||||||
| func adaptiveButtonStyle( | ||||||||||||||
| shape: some Shape = .capsule, | ||||||||||||||
| color: Color = .clear) | ||||||||||||||
| -> some View { | ||||||||||||||
| func adaptiveButtonStyle<S: InsettableShape>( | ||||||||||||||
| shape: S = Capsule(), | ||||||||||||||
| color: Color = .clear | ||||||||||||||
| ) -> some View { | ||||||||||||||
| if #available(iOS 26.0, *) { | ||||||||||||||
| self.foregroundStyle(Color(.label)) | ||||||||||||||
| .padding(8) | ||||||||||||||
|
|
@@ -106,19 +106,9 @@ extension View { | |||||||||||||
| self.foregroundStyle(Color(.label)) | ||||||||||||||
| .padding(8) | ||||||||||||||
| .background { | ||||||||||||||
| Group { | ||||||||||||||
| if color == .clear { | ||||||||||||||
| shape | ||||||||||||||
| .fill(Color(.systemGray5)) | ||||||||||||||
| } else { | ||||||||||||||
| shape | ||||||||||||||
| .fill(color) | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
| .overlay { | ||||||||||||||
| shape | ||||||||||||||
| .stroke(Color.white.opacity(0.2), lineWidth: 1) | ||||||||||||||
| } | ||||||||||||||
| shape | ||||||||||||||
| .fill(color == .clear ? Color(.systemGray5) : color) | ||||||||||||||
| .strokeBorder(Color.white.opacity(0.2), lineWidth: 1) | ||||||||||||||
|
Comment on lines
+109
to
+111
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
배경과 테두리를 함께 적용하려면
Suggested change
|
||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제네릭 타입
S에 대해Capsule()을 기본값으로 설정할 수 없습니다.S는 어떤InsettableShape이든 될 수 있기 때문에 컴파일러가 타입을 추론할 수 없어 오류가 발생합니다.가장 직접적인 수정은 아래와 같이 기본값을 제거하는 것입니다. 하지만 이 경우 기존 호출 코드에 영향을 줄 수 있습니다.
더 나은 해결책은 기본값을 사용하는 오버로드 함수를 추가하는 것입니다: