Swift toolkit for passing messages between iOS apps and extensions.

Overview

SwiftyMessenger CI CocoaPods Compatible Carthage Compatible Platform License

    _________ ___          ___  _   _____  _________ ___    ___
   /        / \  \        /  / |_| ( ___ \ \__   __/ \  \  /  /
  /   _____/   \  \  /\  /  /  | | | (  \/    ) (     \  \/  /
  \_____  \     \  \/  \/  /   | | | (_       | |      \    /
  /        \     \  ____  /    | | |  _)      | |       )  (
 /_______ /       \/    \/     |_| | (        | |       |  |
        \/                         | )        )_(       |__|
                                   |/
      _____        ______    ________  ________  ______   __      __     _____      ______  _________
     /     \      (  ____\  /       / /       / (  ____\ |  \    |  |   /     \    (  ____\ \______  \
    /       \     | (      /   ____/ /   ____/  | (      |  |\   |  |  /   ____\   | (       |        \
   /  /\ /\  \    | (__    \_____ \  \_____ \   | (__    |  | \  |  | /   /__/  |  | (__     |    |____\
  /  /  Y  \  \   |  __)   /       \ /       \  |  __)   |  |  \ |  | \______   /  |  __)    |     \\
 /  /       \  \  | (     /_______/ /_______/   | (      |  |   \|  |  _____/  /   | (       |    | \\
 |_/         |__| | (___/\      \/        \/    | (___/\ |__|    |__| |_______/    | (___/\  |____| |_|
                  (______/                      (______/                           (______/

SwiftyMessenger

Swift toolkit for passing messages between iOS apps and extensions. It creates a bridge between container app and iOS extensions. SwiftyMessenger archives messages in files which are written to the application's shared App Group. SwiftyMessenger resembles interprocess communication between the app and the extension without a interprocess communication.

It also supports CFNotificationCenter Darwin Notifications in an effort to support realtime change notifications. When a message passed, interested parties can listen and can be notified (almost instant) of these changes on both side.

Sample App

Requirements

SwiftyMessenger Version Minimum iOS Target Minimum watchOS Target Swift Version
0.4.0 iOS 10 watchOS 3.0 Swift 5.x
0.2 iOS 9 watchOS 2.0 Swift 4.2
0.1 iOS 9 watchOS 2.0 Swift 4.1

NOTE

SwiftyMessenger can only work with App Group identifiers and Entitlements.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate SwiftyMessenger into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
	pod 'SwiftyMessenger', '~>0.4.0'
end

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

brew update
brew install carthage

To integrate SwiftyMessenger into your Xcode project using Carthage, specify it in your Cartfile:

github "abdullahselek/SwiftyMessenger" ~> 0.4.0

Swift Package Manager

Modify your Package.swift file to include the following dependency:

.package(url: "https://github.com/abdullahselek/SwiftyMessenger.git", from: "0.4.0")

XCFramework

XCFrameworks require Xcode 11 or later and integration is very similar to integration of .framework format. Please use script scripts/build-framework.sh to generate binary SwiftyMessenger.xcframework archive that you can use as a dependency in Xcode.

SwiftyMessenger.xcframework is a Release (Optimized) binary that offer best available Swift code performance.

Usage

Initialization

messenger = Messenger(withApplicationGroupIdentifier: "group.com.abdullahselek.swiftymessenger", directory: "messenger")

Passing message

messenger.passMessage(message: ["selectedCell": title], identifier: "selection")

Reading message

if let message = messenger.messageForIdentifier(identifier: "button") as? [String: Any] {
	let buttonTitle = message["buttonTitle"] as? String
}

Listen message changes with identifier

messenger.listenForMessage(withIdentifier: "button") { message in
    guard let message = message as? [String: Any] else {
        return
    }
    let buttonTitle = message["buttonTitle"] as? String
}

Support for WatchConnectivity

SwiftyMessenger suports WatchConnectivity provided by Apple on watchOS extensions.

Here are two little notes you need to know if you want to use WatchConnectivity support in your app:

  • MessengerSession is a singleton subclass that supports listening for WatchConnectivity messages. It can be used to listen Messenger messages you expect to receive from the WatchConnectivity framework. Be sure to activate the session once your listeners are set so that you can begin receiving message notifications.

  • You can use MessengerSessionContextTransiting when creating your messenger, but it can easily overload the pipeline by sending too many messages at once.

Transiting Types

You can find 5 available types under TransitingType.

  • file (Message transiting by archiving and unarchiving messages that are written and read to files)
  • coordinatedFile (Uses FileCoordinator)
  • sessionContext (Support for the WatchConnectivity framework's Application Context)
  • sessionMessage (Support for the WatchConnectivity framework's real time message passing ability)
  • sessionFile (Support for the WatchConnectivity framework's file transfer ability)

License

SwiftyMessenger is released under the MIT license. See LICENSE for details.

Credits

Inspired by MutualMobile. Improved and all coded in new programming language Swift.

You might also like...
A SlackTextViewController replacement written in Swift for the iPhone X.
A SlackTextViewController replacement written in Swift for the iPhone X.

Installation Just add MessageViewController to your Podfile and install. Done! pod 'MessageViewController' Setup You must subclass MessageViewControll

Swift SDK for Apache Kafka

SwiftKafka A swift implementation of Kafka for producing and consuming from event streams. This works by wrapping the librdkafka C library. Swift vers

A fully fledged syscfg editor. Just the editor. Written in pure swift.
A fully fledged syscfg editor. Just the editor. Written in pure swift.

MagicCFG Reloaded The SysCFG Writing Utility - UPDATED, OSV Report Bug Table of Contents About MagicCFG Reloaded Getting Started Roadmap Contact Credi

Message passing between iOS apps and extensions.
Message passing between iOS apps and extensions.

MMWormhole MMWormhole creates a bridge between an iOS or OS X extension and its containing application. The wormhole is meant to be used to pass data

The SwiftUI Messages Clone consists of layout and composition clones of the iOS Messages app.
The SwiftUI Messages Clone consists of layout and composition clones of the iOS Messages app.

The SwiftUI Messages Clone consists of layout and composition clones of the iOS Messages app. It has Messages-like bubble and screen effects, reactions, and animations, all created with SwiftUI.

Passing data from a couple of screen into a Model
Passing data from a couple of screen into a Model

Passing-Data Passing data from a couple of screen into a Model Introduction Hi, this video is just a representation project from this Video by Essenti

An iOS/OSX bridge for sending messages between Obj-C and JavaScript in UIWebViews/WebViews

WebViewJavascriptBridge An iOS/OSX bridge for sending messages between Obj-C and JavaScript in WKWebViews, UIWebViews & WebViews. Migration Guide When

OpenTok Text Chat Accelerator Pack enables text messages between mobile or browser-based devices.
OpenTok Text Chat Accelerator Pack enables text messages between mobile or browser-based devices.

Text Chat Accelerator Pack iOS This project is deprecated The OpenTok Text Chat Accelerator Pack for iOS project is now a part of Accelerator Core iOS

Easier sharing of structured data between iOS applications and share extensions
Easier sharing of structured data between iOS applications and share extensions

XExtensionItem XExtensionItem is a tiny library allowing for easier sharing of structured data between iOS applications and share extensions. It is ta

Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.
Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.

Introduction EtherWalletKit is an Ethereum Wallet Toolkit for iOS. I hope cryptocurrency and decentralized token economy become more widely adapted. H

Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.
Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.

Introduction EtherWalletKit is an Ethereum Wallet Toolkit for iOS. I hope cryptocurrency and decentralized token economy become more widely adapted. H

SwiftDate 🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.
SwiftDate 🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.

Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift. What's This? SwiftDate is the definitive toolchain to ma

Prototype actor and async/await toolkit for Swift 5.5+

Prototype actor and async/await toolkit for Swift 5.5+

Readium Mobile is a toolkit for ebooks, audiobooks and comics written in Swift & Kotlin.

Readium Swift Toolkit Readium Mobile is a toolkit for ebooks, audiobooks and comics written in Swift & Kotlin. This toolkit is a modular project, whic

BitcoinCore for Bitcoin, BitcoinCash(ABC), Litecoin and Dash wallet toolkit for Swift.

BitcoinCore for Bitcoin, BitcoinCash(ABC), Litecoin and Dash wallet toolkit for Swift. This is a full implementation of SPV node including wallet creation/restore, synchronization with network, send/receive transactions, and more.

Dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers

Frida Dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers. Learn more at frida.re. Two ways to install 1. Inst

GraphQLite is a toolkit to work with GraphQL servers easily. It also provides several other features to make life easier during iOS application development.
GraphQLite is a toolkit to work with GraphQL servers easily. It also provides several other features to make life easier during iOS application development.

What is this? GraphQLite is a toolkit to work with GraphQL servers easily. It also provides several other features to make life easier during iOS appl

Bitcoin protocol toolkit for Swift
Bitcoin protocol toolkit for Swift

Welcome to BitcoinKit The BitcoinKit library is a Swift implementation of the Bitcoin protocol which support both BCH and BTC. Improving the mobile ec

GRDB - A toolkit for SQLite databases, with a focus on application development
GRDB - A toolkit for SQLite databases, with a focus on application development

A toolkit for SQLite databases, with a focus on application development Latest release: May 16, 2021 • version 5.8.0 • CHANGELOG • Migrating From GRDB

Comments
  • Support for share extensions?

    Support for share extensions?

    Great work with the project you've created! I was wondering whether SwiftyMessenger could be used to send messages from a share extension to the main app. In my usecase, I want to save an entry using CoreData from a shared extension and have an already opened app receive a notification to refresh the persistence container's data. What's tricky is that the app extension and main app are two separate processes that have access to the same persistence container data.

    Could SwiftyMessenger be used for this? Or was SwiftyMessenger used more for handling WatchOS extensions? Thanks!

    opened by acosmicflamingo 0
Releases(0.4.0)
Owner
Abdullah Selek
Software geek at @mimecast. ML enthusiast at @verifid. Previously @heremaps, @NetasTr, @hepsiburada
Abdullah Selek
A smooth, responsive and flexible messages UI library for iOS.

AsyncMessagesViewController A smooth, responsive and flexible messages UI library for iOS apps. Built on top of the awesome Texture (formerly AsyncDis

Huy Nguyen 300 Oct 10, 2022
MQTT for iOS and macOS written with Swift

CocoaMQTT MQTT v3.1.1 client library for iOS/macOS/tvOS written with Swift 5 Build Build with Xcode 11.1 / Swift 5.1 Installation CocoaPods Install us

EMQ X MQTT Broker 1.4k Dec 29, 2022
An XMPP Framework in Objective-C for Mac and iOS

XMPPFramework An XMPP Framework in Objective-C for the Mac and iOS development community. Abstract XMPPFramework provides a core implementation of RFC

Robbie Hanson 5.9k Dec 26, 2022
A very flexible message bar for iOS written in Swift.

A very flexible message bar for iOS written in Swift.

SwiftKick Mobile 6.7k Jan 5, 2023
Messenger Clone - Real-time iOS Chat with Firebase Firestore written in Swift

Real time Swift iOS Chat with Firebase - Messenger Clone This is an extremely simple chat app source code of an iOS Swift Chat app. It leverages Messa

Instamobile 621 Jan 6, 2023
Scholarly Article Search, Discussion Forum and Discussion Board

DiscussIt An app to throughly explore vast database of scholarly article, choosing one to experiment with, discuss with your friends An Open Source Ap

Ethan 6 Jun 27, 2022
Open source, native iOS Messenger, with realtime chat conversations (full offline support).

OVERVIEW This is a native iOS Messenger app, with realtime chat conversations (full offline support). NEW FEATURES Passcode support GraphQL server sup

Related Code 4.5k Jan 9, 2023
Chat SDK iOS - Open Source Mobile Messenger

Chat SDK Open Source Messaging framework for iOS Chat SDK is a fully featured open source instant messaging framework for iOS. Chat SDK is fully featu

Chat SDK 879 Jan 6, 2023
Phantom Anonymous Messenger for iOS

?? Phantom for iOS This repository contains the complete source code of Phantom for iOS. Table of Contens ?? Report Bugs/Feature Requests/Security Iss

null 2 Mar 14, 2022
A lightweight framework to build chat applications, made in Swift

Chatto Chatto is a Swift lightweight framework to build chat applications. It's been designed to be extensible and performant. Along with Chatto there

Badoo Tech 4.4k Dec 19, 2022