0

I started to work on on demand resource. I'm able to download the resource but i'm not able to use those resources in other files. please some one help me in fixing this issue. PFA code.

 public class RBPExtensions: NSObject {
    class func prefechDataForTag(_ tagArray: [String], completion: @escaping (_ success: Bool) -> Void) {

            if let tags = NSSet(array: tagArray) as? Set<String> {

               let resourceRequest = NSBundleResourceRequest.init(tags: tags, bundle: Bundle.main)

                resourceRequest.conditionallyBeginAccessingResources { (resourceFound) in
                    if resourceFound {

                        completion(true)
                    } else {

resourceRequest.beginAccessingResources(completionHandler: { (error) in

                            if error != nil {

                                completion(false)
                            } else {

                                let image = UIImage(named: "filter_button_filled")

                                completion(true)
                            }
                        })
                    }
                }
            } else {

                completion(false)
            }

        }
    }

calling this method as :

 RBPExtensions.prefechDataForTag(["Image"], completion: { (success) in

            })
Dhiru
  • 3,040
  • 3
  • 25
  • 69
Manasa
  • 21
  • 1
  • 3

0 Answers0