Created
March 13, 2023 12:18
-
-
Save js/21f8b7871efe85279fc71af970895dbc to your computer and use it in GitHub Desktop.
This file contains 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
import SwiftUI | |
@available(iOS, deprecated: 16.0, message: "Use SwiftUI.scrollContentBackground()") | |
struct HidesScrollContentBackground: ViewModifier { | |
init() { | |
if #unavailable(iOS 16.0) { | |
// beware, affects the app-global appearance proxy: | |
// UITableView.appearance().backgroundColor = .clear | |
} | |
} | |
func body(content: Content) -> some View { | |
if #available(iOS 16.0, *) { | |
content | |
.scrollContentBackground(.hidden) | |
} else { | |
content // Boo | |
} | |
} | |
} | |
@available(iOS, deprecated: 16.0, message: "Use SwiftUI.scrollContentBackground()") | |
public extension View { | |
@ViewBuilder func hidesScrollContentBackground() -> some View { | |
modifier(HidesScrollContentBackground()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment