I follow this tutorial to learn iMessage app.
Everything seems ok.
However, I want to develop a game like
You could put the hidden parameters as part of the URL, like
message.url = URL(string: "http://battleship.example.com/?state=AAAAAA==")!
Note that the URL cannot be more than 5000 characters long (i.e. at most about 3.5 KiB of data after base-64.)
You may want to checkout the tutorial on https://www.shinobicontrols.com/blog/ios-10-day-by-day-day-1-messages.
To prevent cheaters from easily modifying the URL parameters, you might want to encrypt and/or sign the URL parameters.