Post

Replies

Boosts

Views

Activity

Comment on Adding MKCircle to the annotations on the map - Problem with setting CLLocationCoordinate2D
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         }     } }
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Comment on AVPlayer UIButton - show play or pause image button depending on whether the stream is on or off
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.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
Comment on JSON parsing from a static JSON file into the label
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.
Topic: UI Frameworks SubTopic: UIKit Tags:
Sep ’21
Comment on JSON parsing from a static JSON file into the label
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.
Topic: UI Frameworks SubTopic: UIKit Tags:
Sep ’21
Comment on JSON parsing from a static JSON file into the label
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()                     }`
Topic: UI Frameworks SubTopic: UIKit Tags:
Sep ’21
Comment on Adding MKCircle to the annotations on the map - Problem with setting CLLocationCoordinate2D
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         }     } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Comment on Adding MKCircle to the annotations on the map - Problem with setting CLLocationCoordinate2D
Ok, my mistake - Just added mapView.addOverlays(circles!) in viewdidload. Outside viewdidload it wasnt initialized.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
May ’21
Comment on AVPlayer UIButton - show play or pause image button depending on whether the stream is on or off
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.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on AVPlayer UIButton - show play or pause image button depending on whether the stream is on or off
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.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on AVPlayer UIButton - show play or pause image button depending on whether the stream is on or off
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.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on JSON parsing from a static JSON file into the label
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.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on JSON parsing from a static JSON file into the label
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.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on JSON parsing from a static JSON file into the label
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()                     }`
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on Fetch data from API every 5 seconds
Thanks. I've responded in the comment section of the question part.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on Fetch data from API every 5 seconds
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!
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on MPRemoteCommandCenter - Show Now Playing info
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.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on MPRemoteCommandCenter - Show Now Playing info
@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.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Comment on How to store users data - saving reached locations name
@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.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Comment on How to store users data - saving reached locations name
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 :)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Comment on How to add different actions to rightCalloutAcessoryView button for each annotation?
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?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21