Author Topic: How to fix the "Redundant Conformance" compiler error  (Read 15127 times)

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
How to fix the "Redundant Conformance" compiler error
« on: September 11, 2015, 04:29:59 AM »
The Swift 2.0 compiler gives a "Redundant Conformance" error if your class inherits a protocol and additionally declares that it adopts that protocol. To fix the problem, remove the redundant protocol declaration from the class.

For example, the following class is a subclass of UITableViewController which adopts the UITableViewDataSource, so adopting the same protocol is redundant.

Code: [Select]
class GameSetupTableViewController: UITableViewController, UITableViewDataSource {
}

To fix the problem, remove the duplicate declaration:

Code: [Select]
class GameSetupTableViewController: UITableViewController {
}

All the best!
Kevin McNeish
Author of Learn to Code in Swift: https://itunes.apple.com/us/book/learn-to-code-in-swift/id942956811?mt=11
Check out our Robot Tic-Tac-Toe app: https://itunes.apple.com/us/app/robot-tic-tac-toe/id990638517?mt=8
« Last Edit: March 10, 2016, 03:57:54 PM by kjmcneish »