title: Saving and Using a User Input Image in Xcode with Swift
body: <p>I am trying to make a simple iOS game of 15 app where I can get user's input image and make a game out of it. I figured out everything else so far but I do not know how to access user's input image.</p>
  
  <p>So I followed what the guideline told me to do, and I managed to get the image in my first page as you can see in the screenshots.
  However, I do not know how to save the image, divide it into sixteen tiles and repost in the second page so that users can play with the tiles.</p>
  
  <p>So my question is
  1) How do I move the user input image from the first page to second page? Or how do I save the image? </p>
  
  <p>2) how do I split the image in 16 tiles and save them or put them in each image view accordingly? </p>
  
  <p>my code in the first page is</p>
  
  <pre><code>import UIKit
  
  class BeginningPage: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate  {
  
  @IBOutlet weak var ImageView: UIImageView!
  @IBOutlet weak var ImageSelector: UIImageView!
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      // Do any additional setup after loading the view.
  }
  
  func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
      // Dismiss the picker if the user canceled.
      dismiss(animated: true, completion: nil)
  }
  
  func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
  
      // The info dictionary may contain multiple representations of the image. You want to use the original.
      guard let selectedImage = info[UIImagePickerControllerOriginalImage] as? UIImage else {
          fatalError("Expected a dictionary containing an image, but was provided the following: \(info)")
      }
  
      // Set photoImageView to display the selected image.
      ImageView.image = selectedImage
  
      // Dismiss the picker.
      dismiss(animated: true, completion: nil)
  }
  
  //MARK: Action
  
  @IBAction func PressImage(_ sender: UITapGestureRecognizer) {
      let imagePickerController = UIImagePickerController()
      imagePickerController.sourceType = .photoLibrary
      imagePickerController.delegate = self
      present(imagePickerController, animated: true, completion: nil)
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p><img src="https://i.stack.imgur.com/Uhfx6.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/R1gZc.jpg" alt="enter image description here"></p>