Hello friends, this is my 1st post for Swift and today I want to talk about why we should switch to Swift, what the features that swift provides over Objective-C (i.e. Swift Vs ). So some research I found the following reasons for switching to Swift:
  • Fast and Powerful : Swift language is almost 40% faster than Objective C.
  • Swift requires less code : The amount of code we need to write for same function is quite less in Swift as in Objective-C.
  • Swift is designed for Safety : Swift eliminates entire classes of unsafe code. Variables are always initialized before use, arrays and integers are checked for overflow, and memory is managed automatically.
  • Swift has many other features to make your code more expressive:
    • Closures unified with function pointers
    • Tuples and multiple return values
    • Generics
    • Fast and concise iteration over a range or collection
    • Structs that support methods, extensions, and protocols
    • Functional programming patterns, e.g., map and filter
    • Native error handling using try / catch / throw
  • Syntax improvements : New syntax features let you write more expressive code while improving consistency across the language. Some enhancements of swift language includes :
    • Powerful control flow with do, guard, defer, and repeat
    • Keyword naming rules unified for functions and methods
    • Protocol extensions and default implementations
    • Extended pattern matching to work in if clauses and for loops
There are many more reasons for using Swift over Objective-C. Feel free to leave your comments below about what you think the reason for using Swift.
Next
This is the most recent post.
Previous
Older Post

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.