Yes, sorry it is:
class ViewController: UIViewController, MKMapViewDelegate{
Now, the new struct is correct:
struct Szczyt {
var name: String
var describtion: String
var lattitude: CLLocationDegrees
var longtitude: CLLocationDegrees
var coordinate: CLLocationCoordinate2D {
.init(latitude: lattitude, longitude: longtitude)
// here Im trying to create var for this property to set it for all objects
}
}
}
Post
Replies
Boosts
Views
Activity
Ok, my mistake - Just added mapView.addOverlays(circles!) in viewdidload. Outside viewdidload it wasnt initialized.
Hi @Claude31,
I would like to have one button, which change the image from play.png to pause.png, whether the stream is playing or not. Now, as you can find in my code, I have two buttons: play and stop. I just need one button with play and pause image depending on whether stream is playing or not. When the user open the app, the play image on the button should be visible and the button should start an action of playing the stream, than when the stream is playing, user should see pause button to stop the stream etc.
Cool! Thank you. My mistake was that I was trying to add pause.png and play.png in sender.setImage(playImage, for: .normal). I did one change - I have replaced pauseImage and playImage. Now it looks more logical :) Have a nice day and thank you for your time.
Cool! Thank you. My mistake was that I was trying to add pause.png and play.png in sender.setImage(playImage, for: .normal). I did one change - I have replaced pauseImage and playImage. Now it looks more logical :) Have a nice day and thank you for your time.
Wow, I didint expect such a complex answer! Many thanks dor your help and for the quicktype url - it would be useful for the next time. Your solution works fine, but the songs are changing, while on my labels data is still the same. Do you know a solution how to force an update from my api? Is it possible? Data in it is changing when the song is changing, so when the api data is changing. Thank you in advance.
I think I've got two options: the first one is a workaround to call API every 5 seconds (I dont know if it is good idea) - is it hard to make it? The other option is to create webhook - my application can send POST HTTP request to the given URL of the webhook. POST is exactly the same as this: https://admin.radiopromil.online/api/nowplaying , but than I have still the problem with forcing the app to fetch data from webhook url.
In case of the album art - am i doing it right?: ` if let artUrl = URL(string: radio.nowPlaying.song.art) {
//I need to load an image from artUrl
let imageDatatask = session.dataTask(with: artUrl) { imageData, imageResponse, imageError in
let albumArt = UIImage(data: imageData!)
//let albumView = UIImageView(image: albumArt)
}
imageDatatask.resume()
}`
Thanks. I've responded in the comment section of the question part.
Thank you! My mistake was that I was trying it totally different way, without requestNowPlaying(). Now I will try to this again on my own. Enjoy your weekend!
Many thanks - it helped me with the general overlooka t the code. @OOPer but when I try to add it in API call i've got Argument passed to call that takes no arguments. and Cannot find 'artwork' in scope. If I put it outside DispatchQueue.main.async of the album art it could not find albumArt in scope.
@OOPer yes, that was my mistake, sorry. Thanks for your reply. I have one more question - Is there a simple way to add airplay audio button in the app? You know - the one in you can choose audio output. I can see the button on the lock screen control center.
@Claude31 Thank you. I'll try it on later today. Also, can you give me a tip how to start dealing with the question of how to store this data? I would like this data to be kept when user will exit the app. I would like to show that stored data in the list in my second ViewController (szczyt.name and Pin image icon). Thank you in advance.
Thanks, it worked with the button inside pinView - I did the same as in here: https://stackoverflow.com/questions/41495956/how-to-add-button-to-mkpointannotation-in-swift cause I needed the same button. Now I'm trying with storing data :)
Yes, thank you. I will try it this way, looks understandable. @Claude31 do you know how to add to such button like this in annotationView function to open directions (MKLaunchOptionsDirectionsModeDriving) in Apple or Google Maps?