Simulator running example app with a virtual external display

SSMP or Second Screen Mode Protocol, is a lightweight framework that allows the user to use their device as a desktop on a per-app basis. Just connect your device into a display and the device becomes a keyboard and trackpad and you have a desktop. The best part, it only takes a minimum 2 lines of code. This framework was made by me and is 100% open source.

This project is in Swift.

There are 4 ways to install this framework.

Clone the GitHub repository and build the framework Download the framework from the releases Use Carthage (recomended) Cocoapods

If your not using Cocoapods or just want to check out the repo, click here.

Today, we’re going to be installing it with Cocoapods.

Your going to want to install Cocoapods, click here.

Installing the framework:

If you haven’t already, create an Xcode project. Once your project is ready, close it and go to its folder. Now open terminal and type in this (remember to press enter after every command):

cd PathToYourProject

pod init

nano Podfile

Underneath where it says Pods for "your project" , add:

pod 'SSMP'

Press control-X Y enter . That should put you back in the normal command-line. For the final steps, type:

pod install

This will install all the pods and create an xcworkspace which you will be using from now on instead of xcproj. You may need to rebuild the project by pressing CMD+B .

Finally, let's start coding. In your AppDelegate.swift , import SSMP . Then go to didFinishLaunchingWithOptions and set the view controller you want the external display to have:

SSMPApp.default.viewController = MyViewController()

If you use storyboards do this:

let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

let VC = storyboard.initiateInitialViewController() SSMPApp.default.viewController = VC

Lastly, you want to start it.

SSMPApp.default.start()

Done!

Run the app and when you connect a display via dongle (smoothest) or AirPlay (cleanest), your device would become a keyboard and trackpad and the display becomes the main screen.

If you don’t want the mouse pointer and you want the device’s view controller to be overridden, just add this before it SSMPApp starts:

SSMPApp.default.deviceViewController = MyOtherViewController()

More options are at the GitHub repository.

I hope you enjoy my framework. As you can see, it requires very little work and is regularly updated. If you did like it, I would greatly appreciate a star on the GitHub repo. If you have any issues, just put it in the GitHub repo. I would love to hear what you’ve done with this framework, just email me at ethanlipnik@gmail.com