IOS Coredata compatible with both IOS 9 and ios 10

2019-05-23 03:51发布

问题:

Hi I'm developing an app to work with both IOS 10 and 9 (xcode 8). What is the proper way to create new entity object?

new IOS 10 has this code

var newEvent = Event(context: context)

How do we make this code work with both IOS 10 and 9?

I'm testing using Mater-Detail template with coredata xcode8

Any additional change should we make to ensure coredata work with both IOS 9 and 10? any help is much appreciate. Thanks