7 things to do before writing an iOS app (with related resources)

Source: Internet
Author: User
Tags naming convention

    • This article by cocoachina--no longer hesitate ([email protected]) translation

    • @NIkant Vohra

    • Original: 7 things you must absolutely does before writing an IOS app

Over the past two years, I have been writing and publishing quality iOS apps. I found that most developers have a tendency to jump directly into the core logic of the coding application, because that's where the fun lies. It's boring to follow the process development.

The most effective way I've learned is that if you spend some time in advance to set up your project correctly, you'll save a lot of time in the future. If you are an independent developer, you may not be aware of the importance of these steps mentioned below. Most of the best apps are developed by the team, and if you follow these steps, it will definitely help you reduce frustration and improve the quality of your application.

1. Set Code style specifications for the project

Coding style specification refers to the style and convention that is explicitly followed before writing code in a particular language, including the use of the TAB key or the SPACEBAR, how to name variables, and the conventions of a particular language itself (such as whether to use classes or structs in the Swift language).

The coding specification itself is not right or wrong. You can set your own coding style before the project starts, but you must ensure that people in the same group follow the same rules. Coding specifications Ensure that the code is more uniform and easier to read.

Some companies have open source code for the Objective-c and Swift languages.

    • Ray Wenderlich/swift Style Guide

    • Github/swift-style-guide

    • Nytimes/objective-c-style-guide

2. Determine the architecture of the application before writing the code

It is important to determine the application architecture before writing the code. A good architecture improves the testability of your application, makes it easier to understand and reduces maintenance costs. You can use the traditional MVC architecture, or use the more popular MVVM or Viper architecture, which provides a lot of resources to introduce these architectures.

    • IOS Architecture Patterns (Chinese version: IOS architecture mode--decrypt MVC,MVP,MVVM and Viper architecture)

    • Issue Architecture *objc.io

    • Modern application architectures (reactive programming, MVVM and beyond)

3. Set the directory structure of the app

In order for hundreds of source code files to be saved in the same directory, it is best to make the directory structure based on the schema of the project, for example, you can use the following directory structure:

First, in Xcode Project Navigator, under Project name grouping, create them as group (the Small yellow folder), and then, by opening the file Inspector to the right of Xcode, For each group that is created, link to the corresponding directory under the actual project path, click the File Inspector Gray folder icon, and create a subdirectory of the corresponding group name in the project directory.

This seems like a small thing, but it can make your project more organized and easy to understand.

For more information about the directory structure, refer to the following resources:

    • Futurice/ios-good-practices

4. Project Dependency Management

You will of course use a third-party library in your project, where you can manage project dependencies in three ways.

    • CocoaPods

Cocoapods is a dependency management library for Swift and objective-c cocoa projects, with nearly 10,000 open source libraries that elegantly help you manage the size of your project. It is the most efficient way to do dependency management, just like the gems in Ruby.

There is a funny video (address, FQ) created by Google developers on YouTube to explain why Cocoapods must be used in the project.

    • Github submodules

You can also use Github submodules to manage your project dependencies as a sub-library, compared to Cocoapods,github Submodules's advantage is that it is sub-repos-which not only means git and git GUIs can implicitly recognize them, And you can get more support, and it means that your engineering dependencies can be more closely linked to their git repositories, and cocoapods can't.

The problem with Submodules is that your project does not have the source code that you rely on the library, just the repository that references to submodule. In most cases, you can't control these code warehouses.

    • Carthage

Carthage is considered to be the simplest way to add a framework to a cocoa application. Carthage uses Xcodebuild to compile the framework binaries, but leaves the integrated task to the user. The purpose of cocoapods is to be simple to the user, but Carthage is flexible and non-intrusive to the user.

Unfortunately, the biggest drawback of Carthage is that----only supports iOS8 and later versions.

Of these three, I'm most used and my personal favorite is cocoapods, because it's super easy to set up and offers thousands of third-party libraries for you to access.

5. Set the appropriate scheme for the application

When you click the Run, Test, profile, analyze, or archive operation, schemes tells Xcode what will happen. Typically, each operation corresponds to a target and a compilation configuration. You can also pass the startup parameters, such as the language in which the application runs (test localization is useful) or set some of the identifying bits when debugging.

The recommended scheme naming convention is MyApp () [Environment]:

You can also use target to make different publishing, testing, and development to compile the program, as described in the following:

    • How to use Xcode Targets to Manage development and Production Builds

6. Set the appropriate certificates and provisioning Profiles

This is the most frustrating and important step for developers during the testing and publishing of applications. The certificate is required for code signing, and you can run the application on the real machine.

There are two types of certificates:

    • Development Certificate : Each team developer has its own certificate and needs to request a build. Xcode will do this for you, but it's best not to click on the "Fix issue" button and be able to understand what the click button will actually do. The development certificate is the development version of the release app to the device.

    • Publish a certificate: There can be more than one, but it's best to keep one company publishing a certificate to share the relevant key through an internal channel. This certificate is required for publishing to the App Store, or enterprise app distribution within the company.

    • Provisioning Profiles

Provisioning Profiles is probably the most confusing part of the system, and if you visit the Apple Developer site, you'll notice that you can create two types of Provisioning Profiles (development and release). Provisioning Profiles is "The application with this certificate's private key as a signature can function properly on these devices: https://www.quora.com/ What-are-the-differences-between-certificates-provisioning-profiles-and-identifiers

You can read more about the resources:

    • Maintaining Your Signing identities and certificates

    • What's a Provisioning profile? Part 2

7. Set up the application continuous integration and delivery process

Building a continuous integration and delivery process has become critical, as it can now help you find bugs early in development and save a lot of developer time.

Continuous integration (CI) is a development practice that requires developers to synchronize code to a shared repository several times a day. Each submission is validated with an automated script that enables the team to identify problems as early as possible.

Many tools can help you with continuous integration of iOS applications, such as Xcode Server, Jenkins, and Travis CI.

    • About continuous integration in Xcode

    • Travis-ci:test and Deploy with Confidence

    • IOS CI with Jenkins

Continuous Delivery (CD) is a software engineering approach that enables teams to develop software in a short period of time to ensure that software can be reliably released at all times. It is designed to build, test, and publish software faster and more frequently.

Why use continuous delivery?

    • You can save days on preparing app submissions, uploads, and publishing apps.

    • What if you find a serious problem that needs to be repaired and released during a colleague's vacation? You do not need to rely on a person when you publish an updated version.

    • Improve software quality and response time with more frequent and minor versions of updates.

Although there are a lot of tools for continuous delivery, my personal favorite is Fastlane. It's very easy to install and provides some powerful features that can automate your entire compilation and publishing process.

    • Fastlane

If you like this article, welcome the recommendation so that others can also see it.

7 things to do before writing an iOS app (with related resources)

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.