Why enum AVAudioApplication.recordPermission first letter is not big?

The naming follows explicit auditing in AVAudioApplication.h, where it is defined using NS_SWIFT_NAME(AVAudioApplication.recordPermission). This is an intentional decision.

If you believe this is a mistake(+1 from me), you can report it to the framework's maintainers. Since AVAudioApplication is part of the AVKit framework in Apple's SDK, you can submit feedback through Apple's Feedback system.

typedef NS_ENUM(NSInteger, AVAudioApplicationRecordPermission) {
    AVAudioApplicationRecordPermissionUndetermined = 'undt',
    AVAudioApplicationRecordPermissionDenied = 'deny',
    AVAudioApplicationRecordPermissionGranted = 'grnt'
} NS_SWIFT_NAME(AVAudioApplication.recordPermission);

Possible Fix:

While this might be considered a mistake, changing it directly would break source compatibility. A potential resolution would be to introduce a typealias while maintaining backward compatibility.

// AVAudioApplication.h
typedef NS_ENUM(NSInteger, AVAudioApplicationRecordPermission) {
    AVAudioApplicationRecordPermissionUndetermined = 'undt',
    AVAudioApplicationRecordPermissionDenied = 'deny',
    AVAudioApplicationRecordPermissionGranted = 'grnt'
} NS_SWIFT_NAME(AVAudioApplication.RecordPermission);
// AVAudioApplication+Shims.swift
extension AVAudioApplication {
    public typealias recordPermission = RecordPermission
}

This approach allows developers to use RecordPermission while preserving existing API compatibility.

Before Apple provides a fix, you can also manually introduce the following typealias to resolve the capitalization issue:

extension AVAudioApplication {
    public typealias RecordPermission = recordPermission
}
3 Likes

Also, could you help move this post to the right category as I do not have the permission to do so. cc @John_McCall

I moved it to Using Swift as best fit.

2 Likes

thanks for reply, I expect swift will improve this small issue in the future

To be clear, the issue you mention is AVKit issue which is part of Apple SDK and is not part of Swift open source project.

If it were, we can fix it right now with a simple PR :). But it is not.

To be completely clear, this needs to be reported to Apple using their Feedback app or web page.

Ok. Do I need to delete this post?

ok