[Refactor] Reduce code duplication for iOS 14 support
Changelog
- Replaced
iOS14CompatibilityAlertView
with a more generalView+iOS14Compatibility.swift
- Added modifiers mimicking SwiftUI 3
alert
andrefreshable
to reduce code duplication- Unfortunately, we don't have access to
SwiftUI.Button
's internal workings, so we have to introduce_Button
- However, we can still use
Button
to construct eitherSwiftUI.Button
or_Button
depending on the arguments
- Unfortunately, we don't have access to
What happens when we drop iOS 14 support?
- Delete
View+iOS14Compatibility.swift
- Done
Testing
Manually tested on iOS 14.5 and iOS 15 simulators for all alerts.
Known Issues
- Pull to refresh
refreshable
remains unimplemented for iOS 14
Edited by Apollo Zhu