Cannot subscript a value of type 'Self' with an index of type 'Int' in Swift 4?
问题 I have been getting an array index out of range error and then came across this question. Reference link And this is the block of code. import UIKit import Foundation import CoreBluetooth EDIT 1: From what Leo suggested, so the error is gone from this block but index out of range still persists extension Collection where Index == Int { func get(index: Int) -> Element? { if 0 <= index && index < count { return self[index] } else { return nil } } } class Sample:UIViewController{ ....... //This