Explain Swift vs Objective-C.
- Swift is an object-oriented and functional programing language, whereas Objective-C is a class-based object-oriented programing language.
- Swift supports dynamic libraries, whereas Objective-C does not support dynamic libraries.
- Swift supports Tuples, whereas Objective-C does not support Tuples.
- Semicolons are not required in Swift, whereas semicolons are required in Objective-C.
- Swift is an open-source programing language, whereas Objective-C is limited to Apple, and it’s not an open-source language.
- We have to use the “let” keyword to declare for constant and “var” keyword to declare for a variable, whereas in objective C, we have to declare the variable as “NSString” and constant as “int”.
- Swift enables us to define methods in structure, classes or enumeration, whereas Objective C does not allow this.
- In swift, we can define classes in a single file (.swift), whereas in Objective C we create separate interface (.h) files for classes and implementation (.m) files for classes.
