I\'m trying to read/write data in extra class file which is public. (StoreData.swift)
My function :
func FetchName (NameforDate: String) -> NSSt
Your issue:
StoreData.swift:115:49: 'sharedApplication()' is unavailable: Use view controller based solutions where appropriate instead.
Is because -[UIApplication sharedApplication] is not available to extensions. Your extension does not run as part of your application, so there is no application context for an extension to message.
This is clearly explained in the App Extension Programming Guide section on Understanding How an App Extension Works:
Because of its focused role in the system, an app extension is ineligible to participate in certain activities. An app extension cannot:
• Access a sharedApplication object, and so cannot use any of the methods on that object