O'Reilly logo

Professional Swift by Michael Dippery

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

APPENDIX

An Overview of C

WHAT'S IN THIS APPENDIX?

  • Understanding the difference between procedural and object-oriented programming
  • Using key features of the C programming language

WROX.COM CODE DOWNLOADS FOR THIS APPENDIX

You can find the wrox.com downloads for this appendix at http://www.wrox.com/go/proswift on the Download Code tab. The code for this appendix is contained in the following file:

  • boolean.c
  • fnptr.c
  • increment.c
  • overflow.c

This appendix covers the features and concepts introduced by the C programming language. While most Cocoa programs are written in the object-oriented style dictated by Swift (and Objective-C), C's procedural style of programming makes sense for some aspects of a program. Many system services on both OS X and iOS are also exposed only through C, and many third-party libraries and frameworks are written entirely in C, so a firm grasp of C is essential for any skilled Swift programmer.

COMPARING PROCEDURAL AND OBJECT-ORIENTED PROGRAMMING STYLES

Object-oriented programming languages are rooted in the concept of a class. An object, or instance of a class, contains data (instance variables) and defines behavior (methods) that acts on that data and interacts with other objects. This data and behavior are encapsulated in some way so that consumers of those objects can use them without knowing the details of their implementations. Classes also provide a template from which other classes may be created. Programs are modeled as a collection of objects ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required