If I wanted to connect to a server, in Java I would open a Socket and initialize it with port and host address, then retrieve the input/output streams and read/write whatever I want.
In Swift I'm having hard time doing so since it's not built that way and I would really like to see a simple example of how to connect to a server, retrieve the streams and use them.
EDIT1:
This is the tested code after what @Grimxn referenced.
var host = "http://google.com"
var readStream :CFReadStreamRef
var writeStream :CFWriteSteamRef
var socket = CFStreamCreatePairWithSocketToHost(nil, host, 80, readStream, writeStream)
Main issues:
Initializing the two streams above also require the use of CFAllocator which I know nothing about. Using kCFAllocatorDefault did not quite help, same errors.
The above code returns this error: Cannot Convert the expression's type 'Void' to type UInt32.
When I construct a UInt32 using UInt32(80) for example, the error is: Could not find an overload for 'init' that accepts the supplied argument.
I appreciate any help!