0% found this document useful (0 votes)
9 views

Swift Struct

The document discusses Swift structs which are used to store variables of different data types. A struct can be created to store name and age which can then be used for multiple people rather than creating individual variables each time.

Uploaded by

An Tran
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Swift Struct

The document discusses Swift structs which are used to store variables of different data types. A struct can be created to store name and age which can then be used for multiple people rather than creating individual variables each time.

Uploaded by

An Tran
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

SWIFT STRUCT Truong Thi Ngoc Phuong

WHAT IS SWIFT STRUCT


 In Swift, a struct is used to store variables of different data types.
For example,
 Suppose we want to store the name and age of a person. We can create two
variables: name and age and store value.
 However, suppose we want to store the same information of multiple people.
 In this case, creating variables for an individual person might be a tedious
task.

 To overcome this we can create a struct that stores name and age. Now,
this struct can be used for every person.
DEFINE SWIFT STRUCT
STRUCT EXAMPLE
STRUCT INSTANCES
STRUCT MEMBER
INITIALIZER
FUNCTION INSIDE SWIFT
STRUCT
THANKS FOR YOUR
WATCHING

You might also like