4

I want to create a Pictionary kind of app where multiple users can play and guess the drawing made by one person. How is it possible to sync the drawing one device to others globally?

Swati
  • 1,417
  • 1
  • 15
  • 35

4 Answers4

5

You should convert your drawing to a bitmap string. And then send it to the other device using:

  • Bluetooth
  • Firebase
  • socket
  • Push notification (silent push to retrieve data from server).

You can have a good explanation here

Tekaya Marouene
  • 620
  • 3
  • 14
3

You can do this using SocketIO, Create a connection with multiple devices using SocketIO, To send data to another device by socket.emit method and get the same thing by socket.on on the receiver side.

See this example for realtime update/share data using socket IO.

https://www.appcoda.com/socket-io-chat-app/

https://medium.com/@spiromifsud/realtime-updates-in-ios-swift-4-using-socket-io-with-mysql-and-node-js-de9ae771529

AtulParmar
  • 4,358
  • 1
  • 24
  • 45
2
  • This can be achieve through Socket Programming.
  • You should use socket to sync in realtime by converting your drawing into bitmap string.
  • And refesh you Local DB by using NSURLSession
  • Firebase is a Realtime Database, you can use it as well as other option.
  • The good explanation about socket : Tutorial1 & Tutrial 2

Happy coding!

Anand Prakash
  • 313
  • 5
  • 20
0

An easy and simple way i can think of is that you can allow the user to draw on the screen and when ever the user's finger is raised(not touching the screen i.e func touchesEnded ) capture the screenshot of the view as an image and send it to the other users with any service of your choosing. Just like @Tekaya Marouene mentioned above but without bitmap strings.

To draw on the screen refer this answer : https://stackoverflow.com/a/43108524/5295185

Kautham Krishna
  • 967
  • 1
  • 14
  • 33