Your challenge this time is not to build a project from scratch. Instead, I want you to implement three Swift language extensions using what you learned in project 24. I’ve ordered them easy to hard, so you should work your way from first to last if you want to make your life easy!
- Extend
UIView
so that it has abounceOut(duration:)
method that uses animation to scale its size down to 0.0001 over a specified number of seconds. - Extend
Int
with atimes()
method that runs a closure as many times as the number is high. For example,5.times { print("Hello!") }
will print “Hello” five times. - Extend
Array
so that it has a mutatingremove(item:)
method. If the item exists more than once, it should remove only the first instance it finds. Tip: you will need to add theComparable
constraint to make this work!
No screenshots provided (since it is a playground).