Xcode 13.0 Enum cases with associated values cannot be marked potentially unavailable with '@available'
nobut opened this issue · comments
✔️ Issue Checklist
- I have updated PopMenu to the latest version.
- I have read the Contribution Guidelines.
- I have read the Documentation.
- I have searched for GitHub issues.
✍🏻 Issue Description
💻 Environment
- iOS Version: [iOS VERSION]
- Xcode Version: [XCODE VERSION]
- Device(s): [INSERT DEVICE(S) HERE]
- Simulator?: ☑️ or ❌
/// Haptic Generator Helper.
@available(iOS 10.0, *)
public enum Haptic {
/// Impact style.
case impact(UIImpactFeedbackGenerator.FeedbackStyle)
/// Notification style.
case notification(UINotificationFeedbackGenerator.FeedbackType)
/// Selection style.
case selection
/// Trigger haptic generator.
public func generate() {
switch self {
case .impact(let style):
let generator = UIImpactFeedbackGenerator(style: style)
generator.prepare()
generator.impactOccurred()
case .notification(let type):
let generator = UINotificationFeedbackGenerator()
generator.prepare()
generator.notificationOccurred(type)
case .selection:
let generator = UISelectionFeedbackGenerator()
generator.prepare()
generator.selectionChanged()
}
}
}
这样不报错了
I had same problem.
I had same problem too.
Try adding this to your pod file to alleviate that issue. This is probably a little brute force-ish but it will set minimum deployment target on all your projects referenced pods to 10.0, at which point the @available error is no longer an issue as those types are now always available (this project is set to 9.0)
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
end
end
end
The sane issue
大佬,没空处理一下?