title: Ios swift create a constructor for my class
body: <p>I am new to swift and am using Swift 4.0 . I am trying to create a constructor for my class that takes 1 string parameter and am having issues getting it to work. I also get the error</p>
  
  <blockquote>
    <p>Incorrect argument label in call (have 'type:', expected 'coder:')</p>
  </blockquote>
  
  <p>I have been moving things around but it's not working. I want to change my subclass below so that whenever I want to use that class the following signature would be required <strong>CustomAVPLayerC(type: "string")</strong> . This is my first time doing this since I normally work with functions.</p>
  
  <p>This is my code</p>
  
  <pre><code>import UIKit
  import AVKit
  
  class CustomAVPLayerC: AVPlayerViewController {
      var ControllerType: String
  
     init(type: String) {
          self.ControllerType = type
          // perform some initialization here
         super.init(type: "")
      }
  
      required init?(coder aDecoder: NSCoder) {
          super.init(coder: aDecoder)
      }
  
      override func touchesBegan(_ touches: Set&lt;UITouch&gt;, with event: UIEvent?) {
  
          if player?.isMuted == true {
              player?.isMuted = false
              //showsPlaybackControls = false
  
          } else {
              player?.isMuted = true
  
          }
  
  
  
      }
  
  }
  </code></pre>