App Groups Implementation for iOS Inter-App Data Sharing

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
App Groups Implementation for iOS Inter-App Data Sharing
Simple
~1 business day
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing App Groups for Data Sharing Between iOS Apps

App Groups is an iOS mechanism allowing multiple apps by the same developer (and their extensions: widgets, Siri Intents, Share Extensions) to read and write to a shared container. Without App Groups, each target lives in an isolated sandbox: widget doesn't see main app data, Today Extension can't transfer a file.

Setup

Enable App Groups in Capabilities for each target that will participate in sharing (main app + all extensions). Group identifier: group.com.yourcompany.yourapp. Same identifier in each target.

Shared UserDefaults

let sharedDefaults = UserDefaults(suiteName: "group.com.yourcompany.yourapp")
sharedDefaults?.set("active", forKey: "userStatus")
sharedDefaults?.synchronize() // Explicit flush — important before exiting extension

Read in widget exactly the same way. Without suiteName — standard UserDefaults reads only from its own sandbox.

Shared Container for Files

let containerURL = FileManager.default.containerURL(
    forSecurityApplicationGroupIdentifier: "group.com.yourcompany.yourapp"
)!
let fileURL = containerURL.appendingPathComponent("shared_data.json")

// Write
try data.write(to: fileURL)

// Read in extension
let sharedData = try Data(contentsOf: fileURL)

For CoreData with shared store: NSPersistentContainer is initialized with URL from containerURL(forSecurityApplicationGroupIdentifier:).

WidgetKit: Getting Data from App Group

WidgetKit Timeline Provider runs in a separate process. Get current data for widget:

struct Provider: TimelineProvider {
    func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> Void) {
        let defaults = UserDefaults(suiteName: "group.com.yourcompany.yourapp")!
        let count = defaults.integer(forKey: "pendingTasksCount")
        let entry = TaskEntry(date: Date(), count: count)
        let timeline = Timeline(entries: [entry], policy: .atEnd)
        completion(timeline)
    }
}

From main app when updating data: WidgetCenter.shared.reloadAllTimelines() — signal to widget to recalculate timeline.

Timeline Benchmarks

App Groups setup + implementation of shared UserDefaults and file container for two targets — 1 working day, including testing data exchange between main app and extension.