1

I wanted to jump over to use Xcode7.3.1 and convert my code, but I'm facing some kind of problem here,this is how I used to use it in Swift1.1 but I am getting error - Type 'String' does not confirm to protocol to 'SequenceType'

Here is my Code :-

func makeArrayForPrimary(count:Int)
{
    let str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    for character in str //In This line error is there
    {
        var primaryDicArray = [String]()
        for var index = 0; index < self.count; ++index
        {
            var str:String
            var lowerCasestr:String

            var data = self.primaryList.objectAtIndex(index) as String
            let str1 = data
            str = str1

            let str2:String = String(character)
            if str.hasPrefix(str2)
            {
                primaryDicArray.append(str)
            }
        }

        if primaryDicArray.count > 0
        {
            sectionArrayForPrimary.append(String(character))
            self.arr1.append(primaryDicArray)
        }
    }
    self.serviceDataTableView.reloadData()
}
BornShell
  • 381
  • 3
  • 14

1 Answers1

0

Instead of:

for character in str

Use:

for character in str.characters
Roy K
  • 3,319
  • 2
  • 27
  • 43