Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Andrés Leal
9,563 PointsFor what is this <> used in swift?
Can someone explain me how to use this: "<>", I have seen this around <UInt8> but I can't understand.
Andrés Leal
9,563 Pointsfunc getPixelColor(pos: CGPoint) -> UIColor {
var pixelData = CGDataProviderCopyData(CGImageGetDataProvider(self.CGImage))
var data: UnsafePointer<UInt8> = CFDataGetBytePtr(pixelData)
var pixelInfo: Int = ((Int(self.size.width) * Int(pos.y)) + Int(pos.x)) * 4
var r = CGFloat(data[pixelInfo]) / CGFloat(255.0)
var g = CGFloat(data[pixelInfo+1]) / CGFloat(255.0)
var b = CGFloat(data[pixelInfo+2]) / CGFloat(255.0)
var a = CGFloat(data[pixelInfo+3]) / CGFloat(255.0)
return UIColor(red: r, green: g, blue: b, alpha: a)
}
Alireza Rafiei
4,221 PointsThe only time this symbol is used in Swift is in protocol composition type:
Watch Swift protocol lectures, I'm not there yet myself!
Andrés Leal
9,563 PointsThank you, that really help! :D
Alireza Rafiei
4,221 PointsAlireza Rafiei
4,221 PointsProvide an example.