title: How to add sticker VIEWS to browser view in swift?
body: <p>Alright, like everyone Im new to ms stickers in Swift but I am trying to figure out the purpose of / difference between an mssticker and msstickerview. I have read the API here <a href="https://developer.apple.com/reference/messages/msstickerview/1648434-sticker" rel="nofollow">https://developer.apple.com/reference/messages/msstickerview/1648434-sticker</a> but cant find an answer to this relatively simple problem - it seems you can only add MSStickers (not StickerViews) to an MSStickerBrowserView, which is the only way to display them. I however need to add StickerVIEWS because I have a custom sticker view class I am trying to implement. </p>
  
  <p>My stickers are added to my browser view here:</p>
  
  <pre><code>func loadStickers() {
  
  
          var url: URL?
          var i = 1
          while true {
              url = Bundle.main.url(forResource: "test\(i)", withExtension: "png") //change test for packs
              print("URL IS THIS: \(url)")
              guard let url = url else { break }
  
              //make it a sticker
              let sticker = try! MSSticker(contentsOfFileURL: url, localizedDescription: "")
              let stickerView = InstrumentedStickerView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
              stickerView.sticker = sticker
              stickerView.delegate = self
  
              stickerViews.append(stickerView)
              stickers.append(sticker)
  
              i += 1
          }
  
      }
  
  
  func createStickerBrowser() {
          let controller = MSStickerBrowserViewController(stickerSize: .regular)
  
          addChildViewController(controller)
          view.addSubview(controller.view)
  
          controller.stickerBrowserView.backgroundColor = UIColor.white
          controller.stickerBrowserView.dataSource = self
  
          //resize this programmatically later
          view.topAnchor.constraint(equalTo: controller.view.topAnchor).isActive = true
          view.bottomAnchor.constraint(equalTo: controller.view.bottomAnchor).isActive = true
          view.leftAnchor.constraint(equalTo: controller.view.leftAnchor).isActive = true
          view.rightAnchor.constraint(equalTo: controller.view.rightAnchor).isActive = true
      }
  </code></pre>
  
  <p>As you can see, I am creating both a sticker and a sticker view for each sticker - my stickers are stored in the <code>stickers</code> array and sticker views in <code>stickerViews</code> array.</p>
  
  <p>Here is how the browser is populated:</p>
  
  <pre><code> func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -&gt; Int {
          return stickers.count
      }
  
      func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -&gt; MSSticker {
          return stickers[index] //this isnt displaying stickerveiws only stickers
      }
  </code></pre>
  
  <p>I have tried changing the return type on these methods to StickerView and returning the stickerView array instead</p>
  
  <pre><code> func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -&gt; MSStickerView {
          return stickerViews[index] //this isnt displaying stickerveiws only stickers
      }
  </code></pre>
  
  <p>however this gets me the following error:</p>
  
  <blockquote>
    <p>messagesviewcontroller does not conform to protocol
    msstickerbrowserviewdatasource</p>
  </blockquote>
  
  <p>Because the required function isn't being implemented as it was before. How does one display sticker views? What am I doing wrong?</p>