Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 2.7 KB

README.md

File metadata and controls

52 lines (40 loc) · 2.7 KB

Session-6-Codable

Codable Feature in Xcode 9 and later

Codable

NSTehran Session 6

Table Of Contents

  1. Simple Codable
  2. Nested Codable
  3. Customize CodingKey
  4. Error Handling
  5. Customiz Codable
  6. Class Inheritance
  7. Coding Strategies
  8. Usage Such as Alamofire

Codable in Playground

Overview

Theses Playgrounds represent how to use codable in your project. we going to learn Codable and find this awesome feature

The Steps, we walk through in, contain below items:

  • first, we create a simple json string and convert it to Swift DataTypes such Struct,Class and etc.
  • second, we create nested json object string and covert into Nested Objects
  • third, we customize CodingKey when our json string has custome key named
  • 4th, we make a mistake on decoding then we learn how to use catch decoding or encdoing error
  • 5th, we jump into Encodable and Decodable Protocol and how to override theses methods to customize encoding and decoding or create a custom validation which Codable errors do not invole it.
  • 6th, we defind base class and a class which inherite from base. Then we implement Codable method and how to send encoding or decoding container to base class
  • 7th, we walk into Encoding or Decoding stratiges such as convert date string into Date in decoding and etc.
  • 8th and last, we accept a awesome challenge which use Codable in our project or create decodable response or encodable request in Alamofire

Session Resources

Codable Apple Documents

Watch the WWDC session introducing the Codable WWDC Video