Core Data on iOS9 and iOS10 simultaneously

0

Good afternoon,

I have a question about Swift (and Xcode), related to Core Data. The problem I have is that I am doing an app with Swift 3 in Xcode 8, and this in principle supports iOS9 and iOS10 but when instantiating the appDelegate and the Context (to then be able to get (or put) from each Entity what I need ), on iOS9 it is impossible for me. I thought that it is best to do something like:

#if avaliable(iOS10,*)
{
     //CodigoParaiOS10
} else
{
    //CodigoParaiOS9
}

The problem I see with this solution is that for iOS9 I do not know what to use to get the context variable. I've seen codes in StackOverflow but nothing works for me. I've also tried to find iOS9 tutorials, but as they are in Swift 2 or 2.3, and there are many functions that have been changed or removed, and therefore it does not work for me either.

Any other ideas?

    
asked by Josep Bernad Espinosa 23.04.2017 в 20:05
source

1 answer

0

The answer I have published in this link. It is the link of an identical question.

CoreData for iOS9 and iOS10 simultaneously

In my answer is the whole code of:

AppDelegate.swift

MasterViewController.swift

DetailViewController.swift

From these codes you can develop the application that is and that uses CoreData for iOS9 and iOS10 simultaneously.

This is the original Apple Master-Detail Application template updated with Xcode 8.2.1 (the latest to date), using Swift 3 language.

    
answered by 24.05.2017 / 11:32
source