Saturday, 31 December 2016

SceneKit Sample - Globe surrounded by clouds

Recently I have been learning SceneKit framework provided by Apple on iOS and macOS platform. I have created a Swift playground sample using Xcode 8 and Swift 3.0 to display globle surrounded by clouds.

Note: The code and resources have been taken from the sample provided in WWDC 2013 - SceneKit session.

The output of the playground is as shown below:


The sample can be found in the github repository: SceneKitSample. You can get more explanation about the code here.

Besides playground sample, I have created an Application sample which could be run on the device. This allows you to switch on/off features to see how those impact the output. Also scenekit output quality on the device is much better than the simulator so I would recommend you to run this sample on the actual device.

The output will look like as shown below:


Wednesday, 20 January 2016

iOS Swift- Sending Photos peer-to-peer using NSNetServices and NSStream

Recently I have been exploring NSNetServices and NSStream to send data between two iOS devices. The easiest way to do it is using Apple Multipeer Connectivity. However, I wanted to explore NSNetService and NSStream. There are few reasons why I used those APIs. First this has helped me to understand the complexity and issues while implementing networking Apps at a lower level. Second the concepts are useful while connecting the iOS devices with low Bluetooth energy devices.

In the sample App two iOS devices can send photos to each other. You can download my sample App from here.  Please click on the video to see the demo of the App.



I have used NSNetService to publish and browse photo sharing service. NSNetService can be used to publish the service and NSNetServiceBrowser can be used to browse published services. Once service is found and resolved then NSOutputStream is used to send photos and NSInputStream is used to receive photos.

I have used following resources to implement the sample App:
NSNetServices and CFNetworking programming guide
WiTap Sample
Stream Programming Guide

I plan to write more about the topic and update my code as I get a better understanding of the topic. Please let me know if you find any problems in the code.