This PR introduces significant updates to the KSCrash library, focusing on enhancing compatibility with Swift, modernizing the Objective-C code, and improving maintainability. Below are the key changes made:
Major Changes:
Swift-Compatible Initializers and Methods:
Replaced all class and instance initializers with instancetype to ensure better compatibility and consistency across Swift and Objective-C. This change improves type safety and makes the codebase more modern and reliable.
Introduction of Nullable Annotations:
Applied nullable annotations to parameters and return types, where applicable, to clarify which values can be nil. This change is crucial for Swift interoperability, reducing potential runtime errors and improving code clarity.
Refactor Enums to NS_ENUM:
Updated traditional C-style enums to NS_ENUM to enhance type safety and facilitate smoother integration with Swift. This modification allows enums to be used more effectively in Swift, leveraging the language's type system for better safety and usability.
Modernized Key Access Syntax:
Replaced legacy @KSCrashField_XXX string literal access with KSCrashField_XXX constants to align with contemporary Objective-C practices. This change reduces the risk of errors associated with string literals and ensures a more maintainable codebase.
Swift-Friendly Naming Conventions:
Added NS_SWIFT_NAME annotations to key methods and properties to provide more intuitive names when accessed from Swift. This improves the developer experience, making the API more natural and easier to use in Swift projects.
This PR introduces significant updates to the KSCrash library, focusing on enhancing compatibility with Swift, modernizing the Objective-C code, and improving maintainability. Below are the key changes made:
Major Changes:
instancetype
to ensure better compatibility and consistency across Swift and Objective-C. This change improves type safety and makes the codebase more modern and reliable.nullable
annotations to parameters and return types, where applicable, to clarify which values can benil
. This change is crucial for Swift interoperability, reducing potential runtime errors and improving code clarity.NS_ENUM
:NS_ENUM
to enhance type safety and facilitate smoother integration with Swift. This modification allows enums to be used more effectively in Swift, leveraging the language's type system for better safety and usability.@KSCrashField_XXX
string literal access withKSCrashField_XXX
constants to align with contemporary Objective-C practices. This change reduces the risk of errors associated with string literals and ensures a more maintainable codebase.NS_SWIFT_NAME
annotations to key methods and properties to provide more intuitive names when accessed from Swift. This improves the developer experience, making the API more natural and easier to use in Swift projects.