Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Building Apple Watch Projects

You're reading from  Building Apple Watch Projects

Product type Book
Published in Feb 2016
Publisher Packt
ISBN-13 9781785887369
Pages 298 pages
Edition 1st Edition
Languages
Author (1):
Stuart Grimshaw Stuart Grimshaw
Profile icon Stuart Grimshaw

Table of Contents (17) Chapters

Building Apple Watch Projects
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Exploring the New Platform 2. Hello Watch 3. C-Quence – A Memory Game 4. Expanding on C-Quence 5. On Q – A Productivity App 6. Watching the Weather 7. Plot Buddy – All about Location 8. Images, Animation, and Sound 9. Wear It, Test It, Tweak It, Ship It 10. This Is Only the Beginning Index

Adding some animation magic


We all know, as developers, the pain of finding that an idea that we had thought simple and quick to implement turns out to be much harder than we had imagined. But when programming with WatchKit, you will often find that some quite advanced-sounding technologies are, in fact, extremely easy to use.

WKInterfaceController animation methods are just that, and so we can add some flair to our app by changing the color of the button border – which is to say, the BorderGroup background color - using a call to animateWithDuration.

First, let's add some code to our InterfaceController class, and then we will take a look at what we have done.

  1. Control-drag from the Group in the Document Outline to the code in the assistant editor, to create an Outlet connection:

  2. Enter the name borderGroup as shown, and hit Connect.

    Xcode creates a new IBOutlet (connection) between the interface and the source code:

    @IBOutlet var borderGroup: WKInterfaceGroup!
  3. Next, below the HelloButtonTapped...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}