Attaching value to array isn't impossible, how to add a value to a button/array/image?
<p>I just started coding, so I just simply don't know the most things. I want to make a simple game. I will explain shortly: When the user pressed the "Click to start" game button, 7 out of the 52 cards in a card deck will be revealed. I did this by creating several buttons that hold an image of a back of a card. So when the user clicks the button, 7 cards will be opened with a random card. </p>

<p>First off, I created an array to add all my photo names to the view controller, like this:</p>

<pre><code>var MasterAllCards = ["2_of_clubs", "2_of_spades", "2_of_diamonds", "2_of_hearts", "3_of_clubs", "3_of_spades", "3_of_diamonds", "3_of_hearts", "4_of_clubs", "4_of_spades", "4_of_diamonds", "4_of_hearts", "5_of_clubs", "5_of_spades", "5_of_diamonds", "5_of_hearts", "6_of_clubs", "6_of_spades", "6_of_diamonds", "6_of_hearts", "7_of_clubs", "7_of_spades","7_of_diamonds","7_of_hearts", "8_of_clubs", "8_of_spades", "8_of_diamonds", "8_of_hearts", "9_of_clubs", "9_of_spades", "9_of_diamonds", "9_of_hearts", "10_of_clubs", "10_of_spades", "10_of_diamonds", "10_of_hearts", "jack_of_clubs", "jack_of_spades", "jack_of_diamonds", "jack_of_hearts", "queen_of_clubs", "queen_of_spades", "queen_of_diamonds", "queen_of_hearts", "king_of_clubs", "king_of_spades", "king_of_diamonds", "king_of_hearts", "ace_of_clubs", "ace_of_spades", "ace_of_diamonds", "ace_of_hearts"]
</code></pre>

<p>Than I created an IBAction outlet to my view controller, from my click to start button as followed:</p>

<pre><code>@IBAction func testt(sender: UIButton) {
    TheGoButton.enabled = false
    TheGoButton.hidden = true
    SlotCard1.setImage(UIImage(named: randomcardpicker("Cardslot1")), forState: UIControlState.Normal)
    Playablecard1.setImage(UIImage(named: randomcardpicker("Playablecard1")), forState: UIControlState.Normal)
    Playablecard2.setImage(UIImage(named: randomcardpicker("Playablecard2")), forState: UIControlState.Normal)
    Playablecard3.setImage(UIImage(named: randomcardpicker("Playablecard3")), forState: UIControlState.Normal)
    Playablecard4.setImage(UIImage(named: randomcardpicker("Playablecard4")), forState: UIControlState.Normal)
    Playablecard5.setImage(UIImage(named: randomcardpicker("Playablecard5")), forState: UIControlState.Normal)
    Playablecard6.setImage(UIImage(named: randomcardpicker("Playablecard6")), forState: UIControlState.Normal)
    Playablecard7.setImage(UIImage(named: randomcardpicker("Playablecard7")), forState: UIControlState.Normal)
    //sender.setImage(UIImage(named: randomcardpicker("Cardslot1")), forState: UIControlState.Normal)
}
</code></pre>

<p>My function "randomcardpicker" is as followed:</p>

<pre><code>func randomcardpicker (WhatCarduPlay: String) -&gt; String {
    let randomIndex = Int(arc4random_uniform(UInt32(MasterAllCards.count)))
    let RandomCard = AllCards[randomIndex]
    let RandomValueOfTheCard = AllValues[randomIndex]
    MasterAllCards.removeAtIndex(randomIndex)
    AllValues.removeAtIndex(randomIndex)
    StoreHereAllValues.append(RandomValueOfTheCard)
    StoreHereAllCards.append(RandomCard)

    return RandomCard
}
</code></pre>

<p>As you can see I added a lot of random things, because I can not figure out how to put an addition value to an array, like an Int. Now the button will change to the image correctly, but this button/image needs to hold a value that I can use later to compare 2 values. I read something about Enums, but I could not figure out if this will work at my code.</p>

<p>So my question: How to add a value to this button, so I can use this to compare it to other buttons in the future? </p>

<p>As I am writing this, I was wondering to let the value of the image, be the title of this button, so I can read the value out easy. Correct me if I am wrong!</p>