Use of Codable and Coding Key with JSONEncoder and JSONDecoder in Swift 4

Codable is added with Xcode 9, iOS 11 and Swift 4. Codable is used to make your data types encodable and decodable for compatibility with external representations such as JSON.

Codable use to support both encoding and decoding, declare conformance to Codable, which combines the Encodable and Decodable protocols. This process is known as making your types codable.

Let’s Take an Example with Structure of Movie, here we have defined the structure as Codable. So, We can encode and decode it easily.

Continue reading

What’s new in Xcode 8.3?

Xcode 8.3

Swift 2.3 Deprecation

  • Xcode 8.3 beta 2 no longer supports Swift 2.3. Please migrate your projects containing Swift 2.3 code to Swift 3 syntax by opening the project and choosing Edit > Convert > To Current Swift Syntax.

Other Deprecations and Removal Notices

  • The Automation instrument has been removed from Instruments. Use Xcode’s UI Testing in its place.


  • The Xcode Organizer now supports exporting tvOS apps for Enterprise distribution.


  • Added the XCUISiriService class to XCTest for writing tests which activate Siri with a voice recognition string, and queries for elements in the Siri UI. Use the class to write UI tests for Intents and Intents UI extensions.

Swift Compiler

  • The Swift compiler can now automatically precompile Objective-C bridging headers, which can speed up Debug configuration builds (or other non-WMO builds) of mixed-source projects with large bridging headers. This feature is still experimental, and is disabled by default but can be enabled with the “Precompile Bridging Header” (SWIFT_PRECOMPILE_BRIDGING_HEADER) build configuration setting within Xcode.


  • Changed the user interface for managing signing certificates and provisioning profiles. Certificates are managed from the Accounts preferences pane by selecting a team and clicking Manage Certificates. Automatically managing signing is recommended, however if your app requires manually signing provisioning profiles are managed in the General tab of the project editor. Use the Provisioning Profile dropdown to import or download profiles. In addition it displays profiles that match the current signing configuration of the target.


  • You can invoke Siri using Hardware > Siri after enabling Siri in the Settings app on Simulator.


  • Xcode 8.3 includes Swift 3.1 which is intended to be source compatible with Swift 3.0.
  • Constrained extensions allow same-type constraints between generic parameters and concrete types. For example, the following code defines an extension on Array with Int elements:
  • The Swift compiler now raises an error for modifications of a let property or variable of protocol type after initialization. For example, the following code that compiled in previous versions will now raise an error:

    Code that successfully compiled in previous releases may fail after upgrading.

Interface Builder

  • NSTextField objects created in Interface Builder now have allowsCharacterPickerTouchBarItem turned off by default.

Currently latest beta version is Xcode 8.3 Beta 3. I will update this blog as per versions of Beta.

Happy Coding 🙂

How to create a wrapper for Alamofire and SwiftyJSON? Swift – iOS

This blogpost updated with Swift 3 – Xcode 8 – iOS 10 – Alamofire 4.0


I have posted a basic tutorial about Alamofire and SwiftyJSON How to use Alamofire and SwiftyJSON with Swift?

And some day before we have learned about Use of Blocks(Closures) or Completion Handlers with Function in Swift – iOS

Let’s combine both the topics to make a WRAPPER of Alamofire and SwiftyJSON.
Continue reading

Use of Blocks(Closures) or Completion Handlers with Function in Swift – iOS

Blocks in Objective-C

In Objective-C we are using the blocks(completion handlers) with functions as follows :

- (void)yourFunctionName:(NSString *)yourString withCompletionHandler:(void (^)(NSString *yourResult))block;

Closures in Swift

Closures are self-contained blocks of functionality that can be passed around and used in your code. Closures in Swift are similar to blocks in C and Objective-C and to lambdas in other programming languages.

Syntax with Function

func yourFunctionName(parameter:Type, ... , withCompletionHandler:(result:Type) -> Void)

For more closure syntax :


Function Definition:

func closureReturn(isTest:Bool, withCompletionHandler:(result:String) -> Void) {
        withCompletionHandler(result: "Yes")
        withCompletionHandler(result: "No")

Calling Function:

closureReturn(true) { (result) -> Void in

Output should be respective to value true/false.

In next post I will write a tutorial on a wrapper class for Alamofire with use of SwiftyJSON by using closures.

It will be related to this post How to use Alamofire and SwiftyJSON with Swift? – Swift 2 – iOS 9 – Xcode 7

Happy Coding 🙂

Issue “This certificate has an invalid issuer” because of Apple Worldwide Developer Relations Intermediate Certificate Expiration

I am posting this article because many users are facing this issue like “This certificate has an invalid issuer”

This certificate has an invalid issuer
This certificate has an invalid issuer

As apple have written :

The Apple Worldwide Developer Relations Certification Intermediate Certificate expires soon and we’ve issued a renewed certificate that must be included when signing all new Apple Wallet Passes, push packages for Safari Push Notifications, and Safari Extensions starting February 14, 2016.

As I found an answer in post on the Stack Overflow : This certificate has an invalid issuer regrading Intermediate Certificate Expiration

Follow this steps :

  1. Open KeyChain access, Delete “Apple world wide Developer relations certification authority” (Which expires on 14th Feb 2016) from both “Login” and “System” sections. If you can’t find it, use “Show Expired Certificates” in the View menu
  2. Download AppleWWDRCA.cer and add it to Keychain access > certificates (which expires on 8th Feb 2023)
  3. Everything should be back to normal and working now (Check the certificate is valid and it should be display in green)

Related Articles: