Rectangle 27 0

swift2 'String' does not conform to protocol 'CollectionType' Error in Swift 2.0?


//the Pasteboard is nil if full access is not granted
        let pbWrapped: UIPasteboard? = UIPasteboard.generalPasteboard()
        if let pb = pbWrapped {
            var type = UIPasteboardTypeListImage[0] as! String
            if (type.characters.count > 0) && (image != nil) {
                pb.setData(UIImagePNGRepresentation(image!)!, forPasteboardType: type)
                var readDataWrapped: NSData? = pb.dataForPasteboardType(type)
                if let readData = readDataWrapped {
                    var readImage = UIImage(data: readData, scale: 2)
                    print("\(image) == \(pb.image) == \(readImage)")
                }
            }
        }
type.characters.count
Note
Rectangle 27 0

swift2 'String' does not conform to protocol 'CollectionType' Error in Swift 2.0?


Just a suggestion for where to start learning about this issue... https://developer.apple.com/swift/blog/?id=30 Strings in Swift 2

Note
Rectangle 27 0

swift2 'String' does not conform to protocol 'CollectionType' Error in Swift 2.0?


Just a suggestion for where to start learning about this issue... https://developer.apple.com/swift/blog/?id=30 Strings in Swift 2

Note
Rectangle 27 0

swift2 'String' does not conform to protocol 'CollectionType' Error in Swift 2.0?


//the Pasteboard is nil if full access is not granted
        let pbWrapped: UIPasteboard? = UIPasteboard.generalPasteboard()
        if let pb = pbWrapped {
            var type = UIPasteboardTypeListImage[0] as! String
            if (type.characters.count > 0) && (image != nil) {
                pb.setData(UIImagePNGRepresentation(image!)!, forPasteboardType: type)
                var readDataWrapped: NSData? = pb.dataForPasteboardType(type)
                if let readData = readDataWrapped {
                    var readImage = UIImage(data: readData, scale: 2)
                    print("\(image) == \(pb.image) == \(readImage)")
                }
            }
        }
type.characters.count
Note