What are the advantages and disadvantages of iOS-Swift compared with Objective-C,

Source: Internet
Author: User

What are the advantages and disadvantages of iOS-Swift compared with Objective-C,

Swift is a new development language released by Apple at the 2014 WWDC (Apple Developer Conference). It can run together with Objective-C on Mac OS and iOS platforms, it is used to build applications based on the Apple platform. It is an easy-to-learn and easy-to-use programming language, and it is also the first system programming language with the same performance and fun as the scripting language. Swift's design is based on security to avoid a variety of common programming error categories.

Today, based on the current usage of Swift, We will summarize its advantages and disadvantages compared with Objective-C.

Advantages of "Swift" PK "Objective-C:

1. Concise Syntax:

What we have to admit is that the swift language is simpler than OC, And the header file and header file introduction are lost throughout the project.

2. Accurate Error Reporting:

The error message is displayed directly when an error is reported.

3. Simple variable definition:

Defining variables does not need to distinguish between integer and floating point types. Variables use var and constants use let.

4. Visual interaction effect:

The development tool comes with the Xcode Playgrounds function, which provides powerful interaction effects, allowing Swift source code to display its running results in real time during the writing process.

5. Functional programming support:

The Swift language itself provides support for functional programming;

Objc itself is not supported. Function programming is supported only by introducing the ReactiveCocoa library.

Disadvantages:

1. Swift has not yet been comprehensively promoted:

Many large companies and some old projects still use the OC language for development. It is not easy for old programmers to switch from oc to swift, so when you encounter some problems in the project, you will find that there are almost no people around you who can help you solve the problem, resources on the network are also rare.

2. Swift is not stable yet:

You will find that there are great differences between swift2.0, swift3.0, and swift4.0. Each time you upgrade the development tool, you will see dozens or even hundreds of error prompts, inevitably burst into a cold sweat.

3. Insufficient third-party database support:

When we build a project, we usually use some third parties, but now the swift version of the third party is very rare, so that during the development process, we have to import the OC version of the third party, at this time, it became a hybrid development, and experienced friends will find that some of the compatibility is not so good, and in hybrid development, the project will become larger, and the running speed is really too slow.

4. App size increases:

After Swift is used, the App volume increases by about 5-8 M, so be cautious when using this method. (The reason for the larger size is that Swift is still changing, so Apple did not put the Swift Runtime Library in the iOS system. Instead, every App must contain its corresponding Swift Runtime Library .)

5. The launch method has changed:

When it comes online, you cannot use application Loader to upload package files, and you will be prompted to lose swift support files. You should use xcode to upload files directly.

Benevolent wise, some people say that Swift will replace OC sooner or later, and some people say it will still be the world of OC in a few years. As for the language to choose, it depends on your choice. (The MRC of a large factory with historical burdens has not been cleared yet, and Swift is even more out of reach. It may not be done when the company goes bankrupt, and the cost of transplantation is huge. It's not impossible for a small company to roll around with you .)


Author: Joh snail bait
Link: https://www.jianshu.com/p/73df8495ad3a
Source: Simplified book
Copyright belongs to the author. For commercial reprint, please contact the author for authorization. For non-commercial reprint, please indicate the source.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.