This extends the Int class in Swift, adding a new function isPrime. The function is called from the Int object after it has been intialized.
let myInteger = 5
if myInteger.isPrime {
print ("My integer is prime!")
} else {
print ("My integer is not prime.")
}