CaliCastle / PopMenu

A fully customizable popup style menu for iOS 😎
https://popmenu.cali.so
MIT License
1.6k stars 179 forks source link

Xcode 13.0 Enum cases with associated values cannot be marked potentially unavailable with '@available' #67

Open nobut opened 2 years ago

nobut commented 2 years ago

✔️ Issue Checklist

✍🏻 Issue Description

💻 Environment

nobut commented 2 years ago

/// 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()
    }
}

} 这样不报错了

anilsozeri commented 2 years ago

I had same problem.

VisroliyaHimanshu commented 2 years ago

I had same problem too.

jopache commented 2 years ago

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

sergeymild commented 2 years ago

The sane issue

flyweights commented 2 years ago

大佬,没空处理一下?