0

I am indeting to save a uiview in one view and call it in another view (to save it as PDF)

Anyone knows how can I save and retrieve UIView as NSData in Swift?

Ali
  • 83
  • 1
  • 6

1 Answers1

0

According to this post, you could try this :

let yourViewToData = NSKeyedArchiver.archivedDataWithRootObject(yourView)
if let yourViewFromData = NSKeyedUnarchiver.unarchiveObjectWithData(yourViewToData) as? UIView {
  // Do what you want with your view
}
Community
  • 1
  • 1
Chajmz
  • 729
  • 5
  • 11
  • 2
    If a question is a duplicate of another one, then *flag the question as a duplicate* instead of answering. If you can't flag or don't want to, then make a comment under the question to give the link to the answer. In any case, please avoid answering with the content of an existing answer. Thanks. – Eric Aya May 10 '16 at 11:03