iOS (i)

Source: Internet
Author: User

Learn Swift's content first

You can find some online videos to roughly explore the language features and use of Xcode, and then iterate over the official web-based learning

https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/ thebasics.html#//apple_ref/doc/uid/tp40014097-ch5-id309

Here is a list of iOS development commonly used knowledge points, do not have to learn all at once, language learning and iOS development should be mutually promote, gradually learn.
I. Declaring Constants and Variables

Type Annotations
var welcomemessage:string

Can use keyword for variables
var ' var ' = 1.0

Two
Three primary collection types, Array, Set, and Dictionary, as described in collection types.


Third, function
Define
Functions with no parameters, multiple arguments, and multiple return values

Func someFunction (Argumentlabel parametername:int) {
}

return value
Func Minmax (array: [Int]) (Min:int, max:int)? {
If Array.isEmpty
{return nil}
Else
{return (12,13)}
}

Default Parameter Values

In-out Parameters
Function parameters is constants by default.
Func swaptwoints (_ A:inout int, _ b:inout int) {
Let Temporarya = a
A = b
b = Temporarya
}

Function Types
Equivalent to a function pointer
var mathfunction: (int, int), int = addtwoints

Every function in Swift has a type, consisting of the function ' s parameter types and return type. You can use the this type if any other type in Swift, which makes it easy-to-pass functions as parameters to other functions , and to return functions from functions.

Iv. Enumeration Type
The original enumeration type there are so many to talk about.
Raw value, associated value, recursive definition


V. CLASSES and structures


Liu, protocol


Note: Good code style, notice the space position

iOS (i)

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.