What are some of the major differences between objective c and swift?
Answer / Pankaj Mishra
"Objective-C is a superset of C, originally developed in the early 1980s by Brad Cox and Tom Love. Swift, on the other hand, is a newer language developed by Apple since 2014 as a replacement for Objective-C. Some major differences between them include:
- Syntax: Swift has a more modern syntax, focusing on readability and safety with features like optionals, error handling, closures, and generics, whereas Objective-C uses C-like syntax.
- Runtime: Swift is built on a newer foundation called Swift Standard Library (Swift SL) rather than the Objective-C runtime library used by Objective-C. This makes Swift faster and more efficient.
- Error Handling: In Swift, errors are handled with do-catch blocks, whereas in Objective-C, errors are usually passed around as NSException objects.
- Memory Management: Swift manages memory automatically through ARC (Automatic Reference Counting), while Objective-C developers have to manually manage memory using retain/release or ARC.
"
| Is This Answer Correct ? | 0 Yes | 0 No |
What is an instancetype?
Who introduced objective-c & when?
What is polymorphism in objective-c?
How we can layout subviews in a view?
What are the characteristics of the category?
Does objective c have multiple inheritance? Why not? How to imitate various inheritance?
What is difference between objective c and swift programming?
Explain how to call a function in objective-c?
What is difference between nsstring and nsmutablestring?
Explain types of protocol?
What is the main difference between function calls and messages?
Can you write setter method for a retain property?