Developing for the Apple Watch in Swift

Total Page:16

File Type:pdf, Size:1020Kb

Developing for the Apple Watch in Swift Developing for The Apple Watch in Swift Hampus Nilsson Computas @hjnilsson What’s Up? • Brief about the Watch • Experiment with Swift • Get started with our App • WatchConnectivity etc. Doing iOS Development • Been working with iOS since late 2009 • Computas mainly make apps for government entities • I made the Student ID app • In consulting: Xamarin / web apps are more appropriate right now Quick Brief of Apple Watch • Apple Watch is still new, everyone might not have one • The Interface might be alien • I’ll do a quick brief of the UI so we’re all on the same page • If you already have a Watch, now is an excellent time to play with it! Watch face & Home screen Notifications • Notifications are accessed from the Watch Face • Swipe down • Essentially the same as on the Phone • Can open the app by tapping Force Touch • Or 3D Touch • A “through-the-screen” tap • Push firmer than normally, a secondary type of tap • Used to display options & menus on the watch Glances • Accessed from Watch Face by swiping up • Short previews of apps • Can be updated from phone • Won’t implement this today Text input • Yes it’s possible • Done either using Siri, or by suggestion-based input Using Apps (Trivia Crack) • You launch an app from the home screen • Apps run on device, and do not need the phone to function. • App interaction should be quick • Unless it’s a workout app, it’s dismissed automatically when you “turn off” the watch App Opportunity! • New market (especially in Norway) • Since watchOS 2, there are plenty of opportunities for innovation • “Relatively” easy platform to work with (especially coming from iOS) • A very limited platform = easy to make apps Where to start? • Get a Mac • … also an iPhone… and a Watch • iOS development is not cheap. :) • Then get XCode from the App Store, no other programs necessary We need an idea • Something that’s not included on the Watch • That is useful on it’s own • And is not connected to a product (this is usually the challenge) = Let’s make a Calculator The Watch does not ship with one! ( Outrageous! ) “This should only take an hour” - Every developer, ever We need to learn Swift • We’ll have a short live intro! • Imperative language with functional concepts • Modern • Especially compared to Objective-C Swift Lightning Course • Step 1: Basic flow • Step 2: Types & Functions • Step 3: Working with NS* / UI* Playground! Let’s get going BREAK Back on Track • We learned some Swift • Basic types, loops, classes & optionals • Now it is time to dive into WatchOS Step 0 • Set up the Project • I’ve done this for you here: git clone [email protected]:hjnilsson/ watch-calculator.git • This is tied to com.hjnilsson.watch-calc, less that ideal for you if you try it on the Phone etc. Step 1: Building the Interface • UI is built in Interface Builder, just as far iOS • Set of basic controls are: Labels, Images, Buttons, Pickers, Tables • Uses a stack layout (rows & columns, similar to HTML flexbox) • No dynamic interface - everything must be present always, can only show/hide elements Step 1: Building the Interface • For our app we need: • A set of buttons to input the calculation • A label to display the ongoing calculation & result Step 2: Connecting the Interface • Time to write some code • Clicking the buttons should add digits to the label • A clear button is very useful as well Step 3: Calculate! • We need to actually figure out what 2+2 resolves to • Easy on iOS (there we can cheat), for watchOS we need to do the hard work of parsing. • We’ll make a very dumb parser (simple Left-to-Right) Step 4: More Actions • Finally, let’s add some more actions via Force Touch • Clear can be a Force Touch action • Then we have space for a [ . ] button • Sum can also be one Bonus step: History • We’ll store completed sums • Do so in the WatchExtension class (global singleton; equivalent of AppDelegate on iOS, or Program in C#) • Display them as a new page next to the calculator interface So that’s it! You could almost submit this to the App Store Just need to finish it… Finishing an App • Making the “Core Interaction” is the easy part • Stuff that takes time: • Making all the ancillary functions • Fixing bugs • Arriving to something you are proud of • Addendum: Apps don’t make money, making apps makes money Debugging • Atrocious experience on the Watch • Rarely works like the simulator • Laggy & buggy • Will take time if you have an advanced app DEBUGGING More resources • WWDC Videos: https://developer.apple.com/videos/ wwdc2015/ • WatchKit in Depth 1 & 2 • WatchKit Tips & Tricks • Introducing Watch Connectivity • NSHipster: nshipster.com • Core Intuition podcast (& Slack), coreint.org Questions? If you want the working code it can be found here: git clone [email protected]:hjnilsson/ watch-calculator.git working Hampus Nilsson Computas @hjnilsson / hjnilsson.com.
Recommended publications
  • Deploying Ios and Tvos Devices Using Apple Configurator 2 and Jamf Pro
    Deploying iOS and tvOS Devices Using Apple Configurator 2 and Jamf Pro Technical Paper Jamf Pro 10.9.0 or Later 7 October 2020 © copyright 2002-2020 Jamf. All rights reserved. Jamf has made all efforts to ensure that this guide is accurate. Jamf 100 Washington Ave S Suite 1100 Minneapolis, MN 55401-2155 (612) 605-6625 Jamf, the Jamf Logo, JAMF SOFTWARE®, and the JAMF SOFTWARE Logo® are registered or common law trademarks of JAMF SOFTWARE, LLC in the U.S. and other countries. Apple, Apple Configurator 2, the Apple logo, Apple TV, iTunes, Mac, macOS, OS X, and tvOS are trademarks of Apple Inc., registered in the United States and other countries. IOS is a trademark or registered trademark of Cisco in the U.S. and other countries. All other product and service names mentioned herein are either registered trademarks or trademarks of their respective companies. Contents Contents 4 Introduction 4 What's in This Guide 4 Additional Resources 5 Choosing a Deployment Method 6 Supervision Identities 6 Use a Supervision Identity from Apple Configurator 2 7 Create and Use a Supervision Identity from Jamf Pro 8 Automated Enrollment 8 Requirements 8 Deploying Devices Using Automated Enrollment 11 Manual Enrollment with an Enrollment URL 11 Requirements 11 Deploy Devices Using Manual Enrollment with an Enrollment URL 13 Further Considerations 14 Manual Enrollment with an Enrollment Profile 14 Requirements 14 Create an Enrollment Profile 14 Create and Upload the Supervision Identity 14 Create the "Prepare" Blueprint 15 Create the "Enroll" Blueprint 15 Deploy Devices Using Manual Enrollment with an Enrollment Profile 3 Introduction What's in This Guide This guide provides step-by-step instructions for deploying iOS and tvOS devices using Apple Configurator 2 and Jamf Pro.
    [Show full text]
  • Initial Setup of Your IOS Device
    1. When you first turn on your iOS device, you'll see a screen displaying Hello in different languages. Slide from left to right anywhere on this screen. 2. Select the language you want your iOS device to use, and then the region in which you'll be using your iOS device. This will affect things such as date, time, and contact formatting. 3. Your iOS device requires an Internet connection to set up. Tap the name of your desired Wi-Fi network to begin device activation. § If you're activating an iPhone or iPad (Wi-Fi + Cellular) with active cellular service, you can instead choose cellular activation. 4. Choose whether to enable Location Services. 5. Set up your iPhone as a new device, from an iCloud backup, or from an iTunes backup. § If restoring from backup, you can learn how to restore your content. 6. Sign in with your Apple ID, which you've created previously, or create a free Apple ID. § Alternatively, you can tap Skip This Step to sign in or create an Apple ID later. § If necessary, learn how to create a free Apple ID: 1. Select your birthday, then tap Next: 2. Enter your first and last name, then tap Next: 3. You can then use either your current email address, or choose to get a free iCloud email address. Select the option you'd like, then tap Next. 4. Enter your current email address, or what you'd like for your iCloud email, then tap Next. 5. Enter what you'd like for your password and tap Next.
    [Show full text]
  • View Managing Devices and Corporate Data On
    Overview Managing Devices & Corporate Data on iOS Overview Overview Contents Businesses everywhere are empowering their employees with iPhone and iPad. Overview Management Basics The key to a successful mobile strategy is balancing IT control with user Separating Work and enablement. By personalizing iOS devices with their own apps and content, Personal Data users take greater ownership and responsibility, leading to higher levels of Flexible Management Options engagement and increased productivity. This is enabled by Apple’s management Summary framework, which provides smart ways to manage corporate data and apps discretely, seamlessly separating work data from personal data. Additionally, users understand how their devices are being managed and trust that their privacy is protected. This document offers guidance on how essential IT control can be achieved while at the same time keeping users enabled with the best tools for their job. It complements the iOS Deployment Reference, a comprehensive online technical reference for deploying and managing iOS devices in your enterprise. To refer to the iOS Deployment Reference, visit help.apple.com/deployment/ios. Managing Devices and Corporate Data on iOS July 2018 2 Management Basics Management Basics With iOS, you can streamline iPhone and iPad deployments using a range of built-in techniques that allow you to simplify account setup, configure policies, distribute apps, and apply device restrictions remotely. Our simple framework With Apple’s unified management framework in iOS, macOS, tvOS, IT can configure and update settings, deploy applications, monitor compliance, query devices, and remotely wipe or lock devices. The framework supports both corporate-owned and user-owned as well as personally-owned devices.
    [Show full text]
  • Get One Year Free Apple TV+ When You Buy a New Iphone, Ipad, Ipod Touch, Apple TV, Or Mac
    Get one year free Apple TV+ when you buy a new iPhone, iPad, iPod touch, Apple TV, or Mac. Terms and conditions: • Offer is available for a limited time only. • Offer cannot be combined with other free trials or offers for Apple TV+. • Only one offer per Family, regardless of number of devices purchased. You can share your 1 year free Apple TV+ with up to 5 other family members via Family Sharing. • Redeem your 1 year free in the Apple TV app starting November 1, 2019. Make sure your eligible device is running the latest iOS, iPadOS, tvOS, or macOS. • Offer must be claimed in the Apple TV app within 3 months after first setting up your new device. To see the offer appear, you will need to sign in with your Apple ID on your new device. If you’ve purchased your new device before the launch of Apple TV+ on November 1, you will have 3 months starting November 1 to redeem. • Upon claiming the offer, you commit to a ₪17.90/month subscription that starts immediately after the 1 year free and automatically renews until cancelled. You can cancel at any time in Settings at least a day before each renewal date. If you cancel during your free year, you and your family members will immediately lose access to Apple TV+ and the remainder of your 1-year free trial. You can’t reactivate this trial. Eligible devices: • Any new iPhone, iPad, iPod touch, Apple TV, or Mac capable of running the latest iOS, iPadOS, tvOS, or macOS purchased after September 10, 2019, from Apple or an Apple authorized reseller, is eligible.
    [Show full text]
  • Apple at Work Deployment and Management White Paper
    Apple at Work Deployment and Management Simple to deploy. At any scale. Apple makes it easy for IT teams to administer devices, manage their configuration, distribute apps and content, and secure corporate data. With Apple Business Manager, devices can be distributed directly to employees and used right out of the box, all without manual configuration. And with flexible deployment models across all Apple platforms, IT can get employees up and running faster than ever with the best tools for the job. Management made easy Apple devices have a built-in mobile device management (MDM) framework, making it easy for IT to deploy devices, distribute apps and books, configure settings, and ensure the security of each device. Paired with a third-party MDM tool, IT teams can remotely manage and update devices over the air. And if devices ever go missing, IT teams can remotely and securely erase them. MDM supports configuration for apps, accounts, and data on each device. This includes integrated features such as password and policy enforcement. Controls remain transparent to employees while ensuring their personal information stays private. And IT maintains necessary oversight without disrupting the productivity employees need to succeed. Whether a business uses a cloud-based or on-premise server, MDM solutions are available from a wide range of vendors with a variety of features and pricing for ultimate flexibility. And each solution utilizes the Apple management framework in iOS, iPadOS, tvOS, and macOS to manage features and settings for each platform. Zero-touch deployment Apple Business Manager is a web-based portal for IT administrators to deploy iPhone, iPad, iPod touch, Apple TV, and Mac, all from one place.
    [Show full text]
  • What's New for Enterprise and Education-WWDC 2020
    What’s New for Enterprise and Education WWDC 2020 June 2020 (v1.0) Contents Introduction 3 Integration and Setup 4 Deployment and Provisioning 5 Configuration Management 6 Identity Management 13 Content Distribution 15 Security and Compliance 16 App Updates 21 AppleSeed for IT 23 Deprecated Services 24 Additional Resources 25 2 What’s New for Enterprise and Education June 2020 Introduction This document is for IT administrators who want to learn about the new security and deployment-related features across Apple platforms as of WWDC 2020. There are also updates to Apple School Manager, Apple Business Manager, and AppleSeed for IT, as well as changes to the Apple mobile device management (MDM) protocol and its associated payloads. This document supplements the Deployment Reference for iPhone and iPad, the Deployment Reference for Mac, and Mobile Device Management Settings for IT Administrators, all designed to help administrators understand the key technologies for deploying Apple devices at scale and providing an optimal experience for users. NOTE: This material is provided for information purposes only; Apple assumes no liability related to its use. The Apple software and services discussed hereunder are pre-release versions that may be incomplete and may contain inaccuracies or errors that could cause failures or loss of data. 3 What’s New for Enterprise and Education June 2020 Integration and Setup Apple School Manager and Apple Business Manager System for Cross-domain Identity Management (SCIM) Administrators can use SCIM to import users into Apple School Manager and Apple Business Manager. SCIM allows them to merge Apple School Manager and Apple Business Manager properties (such as SIS user name and grades in Apple School Manager, and roles in Apple School Manager and Apple Business Manager) over account data imported from Microsoft Azure Active Directory (Azure AD).
    [Show full text]
  • What's New for Business
    What’s New for Business WWDC 2021 The latest software updates from Apple enable employees to be more productive and collaborative. IT and security enhancements simplify deployment and management. And platform updates help developers build the next generation of business apps. Connect with your team Enhanced security and deployment for Mac Updates to FaceTime on iOS 15, iPadOS 15 and macOS Apple Configurator for iPhone now makes it possible to add a Monterey enable employees to easily share their screen or T2 or Apple silicon Mac to Apple Business Manager regardless interact with other content with SharePlay. New camera and of where it was purchased. Admins can now remotely install and microphone modes help reduce background distractions. Links remove System Extensions using MDM. Security enhancements to FaceTime calls can now be added to calendar invites and calls include the ability to set a password for recoveryOS and set can now be joined from any device, including other platforms. remote lock on Mac computers with Apple silicon. Software updates have new enforcement options and a Mac can now Be in the moment more seamlessly erase all content and settings in one step. New Focus modes across iOS, iPadOS and macOS help make it easy to concentrate on current tasks by muting non-urgent Extended iPhone and iPad management notifications. Focus status can be broadcast in messaging apps. Managed Open-In controls the flow of corporate data between Notifications have been redesigned and the all-new notification managed or unmanaged apps and has now been extended to summary helps to deliver the right content at the right time.
    [Show full text]
  • Pexip Mobile App for Ios Quick Guide
    Infinity Connect Mobile v4.0 for iOS Quick Guide Installing the Infinity Connect Mobile client The Infinity Connect Mobile client for iOS is available for free from the Apple Store at https://itunes.apple.com/us/app/pexip/id667867771. Follow the instructions to download and install the client on your device. l Version 4.0 is compatible with any iOS device running iOS 8.x or later, and Pexip Infinity version 7 or later. This guide describes how to use version 4.0. l Version 3.0 is compatible with any iOS device running iOS 8.x or later, and Pexip Infinity version 9.x and earlier. This version introduced support for joining a call using video and audio. l Version 1.1 is compatible with any iOS device running iOS 7.x or 8.x, and is optimized for iPhone 5. l Version 1.0.3 is available for devices running earlier iOS versions (iOS 5.1 to iOS 6.x). Allowing Infinity Connect to access your device The Infinity Connect Mobile client for iOS will request access to the following applications on your device: Application Use Allows you to dial out to one of your contacts from within a conference. Contacts Also used to display names and images of participants in a conference if they are in your contacts. Calendars Allows you to integrate your meeting invitations with Infinity Connect. Photos Allows you to share images on your device with other conference participants. Microphone Access is required if you want to send and receive audio. Camera Access is required if you want to send and receive video.
    [Show full text]
  • Building Native Apps for Phone, Tablet, Watch and TV with .NET We Are a World-Class Software Delivery Firm
    Building Native Apps for Phone, Tablet, Watch and TV with .NET We are a world-class software delivery firm. Web App Product Development Development Strategy Agile Product Design Consulting Our clients are market leaders and innovative pioneers. We are recognized agile software development experts. Agile & Beyond And we wroteAnd we wrotethe book.the book. Dave Todaro linkedin.com/in/dtodaro Founder & CEO Ascendle Craig Howard linkedin.com/in/craigmhoward Development Lead Ascendle Device Landscape Creating Apps for Devices Android Java Developer iOS Developer Objective-C/Swift watchOS/tvOS Developer .NET Developer Xamarin Open-source mobile app platform for .NET Xamarin Timeline Mono 1.0 Microsoft Acquires Open Source Xamarin .NET MAUI Cross Platform based Xamarin becomes an Xamarin will become on .NET Framework open source SDK part of .NET 6 2011 2020 2004 2016 2021 Xamarin Company 1.5+ Million Xamarin developed by Developers original Mono team as a in 120 countries around the commercial product world using Xamarin products Xamarin Native C# C# C# Shared C# Up to 75% Business Logic shared code Xamarin Forms C# C# C# Xamarin.Forms - UI Up to 90% shared code Shared C# Business Logic Xamarin Forms Page Layouts Xamarin Forms Content Layouts Xamarin Forms Views Xamarin Forms C# C# C# Xamarin.Forms - UI Upwards of 90% shared Shared C# code Business Logic Xamarin Essentials C# C# C# Xamarin.EssentialsXamarin.Forms - UI Upwards of Xamarin.Forms - UI 98% shared code Shared C# Business Logic Xamarin Essentials Accelerometer Color Email Launcher Permissions
    [Show full text]
  • Quick Guide to Connectivity and the Resound Smart™ App for Ios Introduction to Resound Smart Hearing™ Aids
    Quick guide to connectivity and the ReSound Smart™ app for iOS Introduction to ReSound Smart Hearing™ aids WHICH RESOUND HEARING AIDS ARE SMART HEARING™ AIDS? Here is a list of Smart Hearing aids from ReSound that work with the ReSound Smart™ app. If you’re not sure, please ask your hearing care professional. ReSound LiNX2™ ReSound LiNX™ ReSound LiNX TS™ ReSound ENZO2™ ReSound Up Smart™ ™ 2 ReSound ENZO Apple devices that work with ReSound Smart Hearing aids ReSound Smart Hearing aids support Made for iPhone (MFi) functionality with the following Apple devices. iPhone 7 Plus iPad Pro (12.9-inch) iPod touch iPhone 7 iPad Pro (9.7-inch) (6th generation) iPhone 6s Plus iPad Air 2 iPod touch iPhone 6s iPad Air (5th generation) iPhone 6 Plus iPad mini 4 iPhone 6 iPad mini 3 iPhone SE iPad mini 2 iPhone 5s iPad mini iPhone 5c iPad (4th generation) iPhone 5 SUPPORT AND UPDATES FOR IOS ReSound Smart Hearing aids require iOS 8 or later. Make sure that the latest version of iOS is installed on the Apple device for best performance. For use with the Apple Watch extension, min. watchOS 2 is required for Apple Watch and iPhone must be running iOS 9 or newer. For the most up-to-date information visit www.resound.com/smartapp 3 Pair with your iPhone, iPad or iPod touch HOW TO PAIR YOUR RESOUND SMART HEARING™ AIDS TO YOUR iPhone, iPad OR iPod touch Check battery Turn on Bluetooth Insert a fresh battery in your ReSound Smart Hearing aid. Keep the battery door open so the Swipe upwards from the bottom of the screen to reveal hearing aid cannot power up.
    [Show full text]
  • Mac Os Versions in Order
    Mac Os Versions In Order Is Kirby separable or unconscious when unpins some kans sectionalise rightwards? Galeate and represented Meyer videotapes her altissimo booby-trapped or hunts electrometrically. Sander remains single-tax: she miscalculated her throe window-shopped too epexegetically? Fixed with security update it from the update the meeting with an infected with machine, keep your mac close pages with? Checking in macs being selected text messages, version of all sizes trust us, now became an easy unsubscribe links. Super user in os version number, smartphones that it is there were locked. Safe Recover-only Functionality for Lost Deleted Inaccessible Mac Files Download Now Lost grate on Mac Don't Panic Recover Your Mac FilesPhotosVideoMusic in 3 Steps. Flex your mac versions; it will factory reset will now allow users and usb drive not lower the macs. Why we continue work in mac version of the factory. More secure your mac os are subject is in os x does not apply video off by providing much more transparent and the fields below. Receive a deep dive into the plain screen with the technology tally your search. MacOS Big Sur A nutrition sheet TechRepublic. Safari was in order to. Where can be quit it straight from the order to everyone, which can we recommend it so we come with? MacOS Release Dates Features Updates AppleInsider. It in order of a version of what to safari when using an ssd and cookies to alter the mac versions. List of macOS version names OS X 10 beta Kodiak 13 September 2000 OS X 100 Cheetah 24 March 2001 OS X 101 Puma 25.
    [Show full text]
  • Ipad OS 14 Release Date
    iPadOS 14 release date, compatibility & new features iPadOS 14 - the new software coming to iPads this year - was unveiled at WWDC, here's what you need to know about the new features By Chris Martin , Reviews Editor - Macworld 10 Jul 20 Apple surprised many fans when it unveiled a separate operating system for iPad at WWDC 2019 called iPadOS. This new software freed the tablets from some of the restrictions imposed by running on the same OS as the iPhone and paved a way for two streams of device going forward. Now Apple has announced that iPadOS 14 will arrive on iPads later this year. In this article we will investigate when iPadOS 14 is coming out, if your iPad will get it, and what the best new features are. 1 When will iPadOS 14 be released? iPadOS 14 was announced at WWDC 2020 on 22 June, during the keynote speech. As suspected, the developer preview of iPadOS 14 was made available to Apple Developer Program members straight away. If you're an Apple registered developer you can join Apple's beta programme and give it a try. Apple then released the public beta on 9 July. The public beta program allows eager Apple fans to trial the software - but beware that running beta software can be problematic. If you would like to join the beta testing program and get the software on your iPad before everyone else we explain how to do so here. We also run though how to install iPadOS on your iPad here. Apple didn't reveal when it would officially launch iPadOS 14, saying only that it would be this autumn/ fall.
    [Show full text]