All Projects → AlwaysRightInstitute → SwiftObjCBridge

AlwaysRightInstitute / SwiftObjCBridge

Licence: other
A Swift Objective-C Bridge implemented using @dynamicCallable

Programming Languages

swift
15916 projects
shell
77523 projects

Labels

Projects that are alternatives of or similar to SwiftObjCBridge

uvlayout bridge
Blender Add-On: A bridge between Headus UVlayout and Blender
Stars: ✭ 20 (-53.49%)
Mutual labels:  bridge
matrix-appservice-bridge
Bridging infrastructure for Application Services
Stars: ✭ 119 (+176.74%)
Mutual labels:  bridge
TgTwitterStreamer
Continous Integration from Twitter to Telegram.
Stars: ✭ 55 (+27.91%)
Mutual labels:  bridge
SerialToTCPBridgeProtocol
An error tolerant serial UART to TCP connection, raw data bridge.
Stars: ✭ 16 (-62.79%)
Mutual labels:  bridge
lexik-jose-bridge
An Encoder for the LexikJWTAuthenticationBundle that uses web-token/jwt-framework
Stars: ✭ 27 (-37.21%)
Mutual labels:  bridge
instagram
A Matrix-Instagram DM puppeting bridge
Stars: ✭ 69 (+60.47%)
Mutual labels:  bridge
skype-to-telegram
Skype to Telegram bot, for receive your message from skype in telegram
Stars: ✭ 14 (-67.44%)
Mutual labels:  bridge
teleirc
Go implementation of a Telegram <=> IRC bridge for use with any IRC channel and Telegram group
Stars: ✭ 112 (+160.47%)
Mutual labels:  bridge
rpi-roam-webapp
Setup script and web application for a wireless Raspberry Pi bridge.
Stars: ✭ 13 (-69.77%)
Mutual labels:  bridge
interbtc-spec
interBTC specification for a trust-minimized Bitcoin to Polkadot (and beyond) bridge
Stars: ✭ 16 (-62.79%)
Mutual labels:  bridge
matrix-pstn-bridge
☎️ A Matrix Puppet bridge for the public telephone network that supports a number of VoIP providers (Twillo, Vonage, etc.). Sends and receives voice and SMS.
Stars: ✭ 25 (-41.86%)
Mutual labels:  bridge
can2mqtt
Bidirectional CAN-Bus to MQTT-Bridge
Stars: ✭ 39 (-9.3%)
Mutual labels:  bridge
magento2-pimcore-bridge
Magento 2 module for Pimcore integration.
Stars: ✭ 28 (-34.88%)
Mutual labels:  bridge
react-native-mercadopago-px
🚀 MercadoPago PX bridge for react-native
Stars: ✭ 87 (+102.33%)
Mutual labels:  bridge
SDN-Datacenter
Making a software defined datacenter. Which includes various virtual networks with mutiple network functions deployed on it. This includes SDN network deployed on real hardware.
Stars: ✭ 28 (-34.88%)
Mutual labels:  bridge
native-js-interactive-encapsulation
主要用于vue和原生的交互
Stars: ✭ 18 (-58.14%)
Mutual labels:  bridge
dotnet-design-patterns-samples
The samples of .NET design patterns
Stars: ✭ 25 (-41.86%)
Mutual labels:  bridge
bnbridge.exchange
https://bnbridge.exchange
Stars: ✭ 43 (+0%)
Mutual labels:  bridge
HiveMind-core
Join the mycroft collective, utils for mycroft-core mesh networking
Stars: ✭ 72 (+67.44%)
Mutual labels:  bridge
FlexHybridApp-iOS
WebView bridge interface with Promise pattern
Stars: ✭ 17 (-60.47%)
Mutual labels:  bridge

Swift - Objective-C Bridge

Swift5 macOS

Part of this blog post: @dynamicCallable Part 2: Swift/ObjC Bridge.

In December we demonstrated how to use the new Swift 5 Dynamic Callable feature to run Unix commands as Swift functions, like shell.ls(). Today we implement our very own Swift / Objective-C bridge using the same!

Of course Swift already has Objective-C integrated on the Apple platforms, directly supported by the compiler, as well as the associated bridging runtime.
Yet using Dynamic Callable you can actually build something similar at the library level, and we want to show you how that would look like.

Swift also runs on Linux, but it doesn't come with the Objective-C runtime and bridging features. Using the approach shown here with either libFoundation or GNUstep you could also combine Swift and Objective-C on Linux.

This is what we want to end up with:

let ma = ObjC.NSMutableArray()
ma.addObject("Hello")
  .addObject("World")
print("Array:", ma.description())

For demonstration purposes only: This is just a demo showing what you can do with @dynamicCallable, nothing more! (we also cheat a few times and silently rely on builtin bridging.)

Install a Swift 5 Snapshot

For this to work, you need to have Swift 5 installed. As of today Swift 5 hasn't been released yet, but Apple is providing prebuilt Swift 5 development toolchains over at: swift.org, and you can also use the Xcode 10.2beta. Just install the toolchain, and select it in the Xcode "Toolchains" menu.

If you are living on the commandline, make sure to call export TOOLCHAINS=swift to get access to the selected version.

To try out the samples below, you can either open a Swift 5 Playground or create a command line tool project project in Xcode.

Links

Who

Brought to you by ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].