title: Swift enum function for only a single case of the enum?
body: <p>I want to declare a function which I can only use for a single specific enum case.</p>
  
  <p>For example I have CustomTextFieldTypes enum. This has the following cases and functions.</p>
  
  <pre><code>enum CustomTextFieldTypes {
  
      case CardType
      case CardNumber
      case CardExpiryDate
      case CardName
      case CCVNumber
  
      func inputCardNumber(cardNumber: String!, cardNumberTextField: XCUIElement?) {        
         cardNumberTextField?.typeText(cardNumber)
      }
  
      func inputCardCCVNumber(cardCCVNumber: String!, cardCCVNumberTextField: XCUIElement?) {        
         cardCCVNumberTextField?.typeText(cardCCVNumber)
      }
  }
  </code></pre>
  
  <p>Now I want to call the <code>inputCardNumber(...)</code> function only for the     <code>CustomTextFieldTypes.CardNumber</code> case. I can do the following...</p>
  
  <pre><code>CustomTextFieldTypes.CardNumber.inputCardNumber(...) 
  </code></pre>
  
  <p>But at the same time I can do this... </p>
  
  <pre><code>CustomTextFieldTypes.CardExpiryDate.inputCardNumber(...) or    
  CustomTextFieldTypes.CardNumber.inputCardNumber(...) 
  </code></pre>
  
  <p>I only want to call the <code>inputCardNumber(...)</code> function for the <code>CardNumber</code> case. Not from another case the enum itself. How do I achieve this?</p>
  
  <p>Thanks in advance for any help</p>
  
  <p>EDIT- Here's some background on what I'm doing. I was writing a UI test which would input text into text fields. I wanted to keep the input code away from my test file and I started "<strong>Experimenting</strong>" with enums and enum functions. I was wondering if I could have a function explicitly available for an enum case. Judging from the comments I cannot do this (I checked online but didn't get far). It's not a bad architecture or anything, I was just splitting up test code..</p>
  
  <p>Thanks for everyone for replying.</p>