- Swift 4 Programming Cookbook
- Keith Moon
- 144字
- 2021-07-08 10:21:26
Structs
Objects are great for encapsulating data and functionality behind a unifying and referenceable concept, such as a person. However, not everything is an object; we may have a set of data that is logically grouped together, but that isn't much more than that. It's not more than the sum of its parts--it is the sum of its parts.
For this, there are structs. Short for structure, structs can be found in the C programming language and were, therefore, available in Objective-C, which was built on top of C. If you are familiar with iOS/macOS development, CGRect is an example of a C struct.
Structs are value types, as opposed to classes, which are reference types, and as such behave differently when passed around. In this recipe, we will examine how structs work in Swift, and learn when and how to use them.
- Mastering Ext JS(Second Edition)
- Java多線程編程實戰(zhàn)指南:設(shè)計模式篇(第2版)
- Mastering phpMyAdmin 3.4 for Effective MySQL Management
- C語言程序設(shè)計(第2版)
- 程序員面試算法寶典
- Java編程指南:基礎(chǔ)知識、類庫應(yīng)用及案例設(shè)計
- Learning Network Forensics
- HTML5入門經(jīng)典
- Highcharts Cookbook
- Java Web開發(fā)詳解
- Mastering Akka
- UML2面向?qū)ο蠓治雠c設(shè)計(第2版)
- Laravel Application Development Blueprints
- Delphi開發(fā)典型模塊大全(修訂版)
- Web前端開發(fā)最佳實踐