I am unclear how to use the Radio Icecast library in Swift. How do i translate the following into Swift?
radio = [[Radio alloc] init:@"my app"];
[radio connect:STREAM_URL withDelegate:self withGain:(1.0)];
playing = YES;
I am unclear how to use the Radio Icecast library in Swift. How do i translate the following into Swift?
radio = [[Radio alloc] init:@"my app"];
[radio connect:STREAM_URL withDelegate:self withGain:(1.0)];
playing = YES;
The way that this class implemented
init
is not correct. Generally you'd see a method calledinit
(which takes no parameters) and if you needed a rendition with a user agent parameter, the method would be calledinitWithUserAgent:
.So, in the
Radio.h
file, find the declaration of:And replace it with:
Do the same with the
Radio.m
file.Then the Objective-C syntax becomes:
And the Swift equivalent would be:
Obviously, if this
Radio
class is implemented in Objective-C, then you'd include the .h file in your bridging header. For more information about bridging headers, see the Swift and Objective-C in the Same Project reference.