Book Image

Mastering Swift

By : Jon Hoffman
Book Image

Mastering Swift

By: Jon Hoffman

Overview of this book

Table of Contents (22 chapters)
Mastering Swift
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


As we can see, it takes a lot less code to parse/build JSON objects with the NSJSONSerialization class as compared to parsing/building XML objects. However, we do have a lot more control on how the document is parsed using the NSXMLParser class. The key thing to keep in mind with both the NSJSONSerialization class and the NSXMLParser class is that we need to remember to check that optional variables do not contain a nil value before attempting to use them.

While it seems that the majority of newer services are using the JSON format over XML, it is good to have a working knowledge of both formats because there is still a large percentage of services that use XML.