Post

Replies

Boosts

Views

Activity

Reply to How to use different content in same timeline?
Changed the variables to [String] in the TimelineEntry and I achieved what I want. I updated my struct and entry line like this: var newsList: [String] = [] // First, appending the fetched data here var imageList: [String] = [] struct NewsEntry: TimelineEntry { var date: Date let configuration: ConfigurationIntent let header: [String] let imageUrl: [String] } for index in 0 ..< 5 { newsList.append(data[index].title!) imageList.append(data[index].imageUrlDetail!) } // Then using passing the arrays to TimelineEntry as [String] for hourOffset in 0 ..< 5 { let entryDate = Calendar.current.date(byAdding: .minute, value: hourOffset, to: currentDate)! let entry = NewsEntry(date: entryDate, configuration: configuration, header: newsList, imageUrl: imageList) entries.append(entry) } The only problem right now is I don't know if I'm using it correctly because I get crash with "Index out of range" on entry.imageUrl[index]. This is the LazyVGrid my updated View function: LazyVGrid(columns: columns) { ForEach((0..<4)) { index in ZStack (alignment: .bottomLeading) { if let url = URL(string: entry.imageUrl[index]), let imageData = try? Data(contentsOf: url), let uiImage = UIImage(data: imageData) { // Thread 1: Fatal error: Index out of range Image(uiImage: uiImage) .centerCropped() .frame(maxHeight: 150, alignment: .center) .cornerRadius(10) .overlay(RoundedRectangle(cornerRadius: 10) .stroke(Color.gray, lineWidth: 1)) .shadow(radius: 10) } else { Image("ph_background") .centerCropped() .frame(maxHeight: 150, alignment: .center) .cornerRadius(10) .overlay(RoundedRectangle(cornerRadius: 10) .stroke(Color.gray, lineWidth: 1)) .shadow(radius: 10) } Text(entry.header[index]) .font(.system(size: 12)) .foregroundColor(.white) .fontWeight(.light) // .frame(maxHeight: 50) .background(Rectangle().fill(Color.black).blur(radius: 20)) .padding(.bottom, 5) .padding(.leading, 5) .padding(.trailing, 5) .padding(.top, 5) } } .frame(height: 160) }
Sep ’21
Reply to Updating an app with new features without uploading it to App Store(but still having it updated on all phones where the app is installed on)
I think Spotify does update its UI changes without actually updating the application all the time. I think you can achieve this with backend services easily. You can set up your new views including UI changes and check if a variable from the service is true or false. If true, use the UI with changes, else use the old one. I don't know about guidelines tho. It sounds easily abusable.
Aug ’21
Reply to apple testflight question
An account with Administrator rights would be dangerous to give 3rd party people because Administrator accounts have permission like withdrawing the income money etc. You (or even themselves) can create an account and then you can give App Manager rights to the account, it'd be enough if their job is gonna be only to do the upload process. They might need your rights while setting the certificates, but other than that, App Manager rights should be alright.
Aug ’21
Reply to Swift - How to Call and Show XIB/StoryBoard inside from XIB?
I have found the answer by using delegates. Now I can hide/unhide (edit, overall) the view's properties. This was the problem answered by Sh_Khan: Problem is here DetailViewController().setupPodcastPlayer(link: url) This DetailViewController() is a new instance not the presented one , hook the real shown one and change it's attribute as needed through delegate or a notification if you need to I have declared a delegate in PodcastViewCell: swift var delegate: PodcastViewCellDelegate? and its protocol for passing data : swift protocol PodcastViewCellDelegate {     func podcastButtonClicked(podcastUrl: String) } In the View Controller, I want to edit element from, added this : swift extension DetailViewController: PodcastViewCellDelegate {     func podcastButtonClicked(podcastUrl: String) {         setupPodcastPlayer(link: podcastUrl)         podcastPlayerView.isHidden = false     } } Now my player works as expected and I can hide/unhide my UIView! Thank you for all of your efforts again! Hope to see you in another thread 😅
May ’21
Reply to Swift - How to Call and Show XIB/StoryBoard inside from XIB?
I can easily hide/unhide the podcastPlayerView in viewWillAppear, or a function calling in the viewWillAppear. But after the load, if any function tries to hide/unhide the view, the application crashes. It's like the view gets destroyed after load. Searched for a force loading method but couldn't find anything working for me. One of them was adding this to viewDidLoad() but I still can't reach the podcastPlayerView swift view.addSubview(podcastPlayerView)
May ’21
Reply to Swift - How to Call and Show XIB/StoryBoard inside from XIB?
My view controller for podcasts table, now it plays the podcast too. swift class DetailViewController: BaseViewController {     @IBOutlet weak var collectionView: UICollectionView!     @IBOutlet weak var podcastPlayerView: UIView!     var podcastLink: String = ""     static var itemId = "0"     var player: AVPlayer?     var playerItem: AVPlayerItem?     var timeObserverToken: Any?     var played = false     override func viewDidLoad() {         super.viewDidLoad()         "self.podcastPlayerView.isHidden = false" "-------- Unhiding process successful in this step"     }     override func viewWillDisappear(_ animated: Bool) {         showPodcastButton = false         player?.pause()         player?.replaceCurrentItem(with: nil)         player = nil     }     func setupPodcastPlayer(link: String) {         player?.pause()         player?.replaceCurrentItem(with: nil)         player = nil         if !played {             if link != "" {                 playerItem = AVPlayerItem( url:NSURL( string:link )! as URL )                 player = AVPlayer(playerItem:playerItem)                 player!.rate = 1.0;                 player!.play()                 played = true                 didPlayedOnce = true                 podcastPlay()             } else {                 "link empty"             }         } else {             player?.replaceCurrentItem(with: nil)             played = false         }     }     func podcastPlay() { self.podcastPlayerView.isHidden = false "---- If I try to unhide here, app crashes." "Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value"     } } The "Play Button" action from PodcastViewCell, where I call ViewController's player function. This only passes the cell's podcast link. swift @IBAction func playPodcast(_ sender: Any) {         NotificationCenter.default.addObserver(self, selector: #selector(playerItemDidReachEnd), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: nil)         if let itemOffset = DetailViewController.allItems?.itemListv2.firstIndex(where: {$0.itemId == itemAuthor?.itemId}) {         podcastLink = DetailViewController.allItems?.itemListv2[itemOffset].podcastsound         } let url = podcastLink ?? " "         requestAuthorDetailViewController.setupPodcastPlayer(link: url) }
May ’21
Reply to Swift - How to Call and Show XIB/StoryBoard inside from XIB?
I am able to hide/unhide the view in general when I try to do it on most functions. But I get the error when I try to do it on one specific function: the function I call from nib file. I don’t know what is the issue but I think this usually happens if I try to change an element’s properties before loading it. But all of the other elements are loaded when I call the function, like play button or podcast title label.
May ’21
Reply to Swift - How to Call and Show XIB/StoryBoard inside from XIB?
I've achieved to play my player outside of the xib, in my view controller as you suggested earlier. Thanks for the idea again! Then I created a container view for the playerViewCell nib on my storyboard for the player and marked it as hidden. When I try to unhide it with swift podcastView.isHidden = false I always get debugger "Unexpectedly found nil while implicitly unwrapping an Optional value" I don't know why it isn't loaded even tho the controller's other elements (like play button, etc.) on the screen. (Even tried to use dummy UIView and just unhide it but still got the same error.)
May ’21