{"id":18936386,"url":"https://github.com/vaporexampleslab/synergy","last_synced_at":"2026-03-21T03:30:15.752Z","repository":{"id":133115018,"uuid":"177878716","full_name":"VaporExamplesLab/Synergy","owner":"VaporExamplesLab","description":"Various pieces of how to setup a Vapor server, iOS device client and a macOS client to use the same Swift Packages.","archived":false,"fork":false,"pushed_at":"2019-05-19T17:37:24.000Z","size":281,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-31T21:26:12.794Z","etag":null,"topics":["swift-package-manager","vapor","vapor-example"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VaporExamplesLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-26T22:34:26.000Z","updated_at":"2022-06-22T15:59:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"3b4ede9c-3fef-467c-9cd6-d10507ba463f","html_url":"https://github.com/VaporExamplesLab/Synergy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VaporExamplesLab%2FSynergy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VaporExamplesLab%2FSynergy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VaporExamplesLab%2FSynergy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VaporExamplesLab%2FSynergy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VaporExamplesLab","download_url":"https://codeload.github.com/VaporExamplesLab/Synergy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239937702,"owners_count":19721482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["swift-package-manager","vapor","vapor-example"],"created_at":"2024-11-08T12:07:14.837Z","updated_at":"2026-03-21T03:30:15.704Z","avatar_url":"https://github.com/VaporExamplesLab.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Synergy: Vapor Server + Device Apps\n\n\u003ca id=\"toc\"\u003e\u003c/a\u003e\n[SynergySqliteC](#linkSynergySqliteC) • \n[SynergySQLiteFramework](#linkSynergySQLiteFramework) • \n[SynergyAPI](#linkSynergyAPI) • \n[SynergyVapor](#linkSynergyVapor) • \n[Synergy Clients](#linkSynergyClients) • \n[Resources](#Resources)\n\nI've been using Swift Packages for both iOS/macOS clients and Vapor backend development for some time.  I'm in the process of gathering the lessons learned into a generic set of Open Source repositories: \u003ccode\u003e[VaporExampleLabs/Synergy*](https://github.com/VaporExamplesLab/Synergy)\u003c/code\u003e.\n\nIt is possible to have Swift Packages which can be used on the Swift server side, and on iOS devices and in macOS applications.  A greater separation between the views (Vapor `View`, iOS `UIView`, macOS `NSView`) and underlaying application logic, allows more code to be shared in Swift Packages across the platforms. \n\nThe \u003ccode\u003e[VaporExampleLabs/Synergy*](https://github.com/VaporExamplesLab/Synergy)\u003c/code\u003e collection of packages \u0026 projects provides various working pieces of how to setup a Vapor server, iOS device client and a macOS client to use the same Swift Packages.\n\nEach part highlights some key findings for the use of a Swift code shared in both Server backend and Client device software development.\n\n_Note: The Synergy set of projects and packages are still a **work in progress** for gathering lessons learned. The goal is to create a full (self-contained) set of backend-to-client connected examples sharing common Swift Packages._\n\n## SynergySqliteC \u003ca id=\"linkSynergySqliteC\"\u003e\u003c/a\u003e[▴](#toc)\n\nSometimes lower level libraries are not common between the server and device.  For example, the database Object Relationship Model (ORM) is different for Vapor and iOS/macOS have CoreData. Vapor provides Fluent. iOS/macOS provides CoreData.\n\nThis example illustrates direct use the SQLite C source code at the lowest level.\n\n\u003ccode\u003e[SynergySqliteC ⇗](https://github.com/VaporExamplesLab/SynergySQLiteC)\u003c/code\u003e shows how to setup a cross platform C library into a Swift Package.\n\n## SynergySQLiteFramework \u003ca id=\"linkSynergySQLiteFramework\"\u003e\u003c/a\u003e[▴](#toc)\n\n\u003ccode\u003e[SynergySQLiteFramework ⇗](https://github.com/VaporExamplesLab/SynergySQLiteFramework)\u003c/code\u003e provides a _generic_ Swift framework for using the C-base Swift Package `SynergySqliteC`.\n\n## SynergyAPI \u003ca id=\"linkSynergyAPI\"\u003e\u003c/a\u003e[▴](#toc)\n\n\u003ccode\u003e[SynergyAPI ⇗](https://github.com/VaporExamplesLab/SynergyAPI)\u003c/code\u003e provides the Codable interface for the collection of Synergy applications.  Uses the generics SQLite package `SynergySQLiteFramework`.\n\n## SynergyVapor \u003ca id=\"linkSynergyVapor\"\u003e\u003c/a\u003e[▴](#toc)\n\n\u003ccode\u003e[SynergyVapor ⇗](https://github.com/VaporExamplesLab/SynergyVapor)\u003c/code\u003e provides an example Vapor web application which uses the `SynergyAPI`.\n\n## Synergy Clients \u003ca id=\"linkSynergyClients\"\u003e\u003c/a\u003e[▴](#toc)\n\n\u003ccode\u003e[Synergy ⇗](https://github.com/VaporExamplesLab/Synergy)\u003c/code\u003e provides both an iOS and macOS client Xcode projects.  Both the iOS and macOS clients use the `SynergyAPI` package.\n\n\n**Swift Packages in iOS/macOS Applications**\n\n\u003e Note that at this time the Package Manager has no support for iOS, watchOS, or tvOS platforms. [Source: Swift Package Manager Project](https://github.com/apple/swift-package-manager)\n\nEven though the Swift Package manager _can not directly_ create an iOS or macOS application, Swift Packages can still be used as subprojects in the respective Xcode application projects.  \n\n``` bash\ncd SynergyAPI\n\nswift package generate-xcodeproj \\\n    --xcconfig-overrides Package.iOS.xcconfig \\\n    --output SynergyAPI_iOS\n\nswift package generate-xcodeproj \\\n    --xcconfig-overrides Package.macOS.xcconfig \\\n    --output SynergyAPI_macOS\n```\n\n![SubprojectSynergyAPI](README_files/SubprojectSynergyAPI.png)\n\n## Resources \u003ca id=\"Resources\"\u003e\u003c/a\u003e[▴](#toc)\n\n* [StackOverflow: How do I use Swift Package Manager with an existing macOS project? ⇗](https://stackoverflow.com/questions/48837369/how-do-i-use-swift-package-manager-with-an-existing-macos-project)\n* [StackOverflow: Vapor server and companion iOS app examples ⇗](https://stackoverflow.com/questions/47717355/vapor-server-and-companion-ios-app-examples/48373393#comment97266087_48373393)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaporexampleslab%2Fsynergy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaporexampleslab%2Fsynergy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaporexampleslab%2Fsynergy/lists"}