Posted on Leave a comment

Challenge: Create fun visual effects in Swift Playgrounds

Hammer symbol and paint brush symbol

Ever wonder how to make it seem like confetti is raining down from the sky? Or how to create a kaleidoscope effect using code? In this challenge, your goal is to create a compelling visual effect using the Shapes book from the Swift Playgrounds app. Maybe it’s a constellation of objects revolving in intriguing mathematical patterns, or a textural and fluid shape that adapts to your touch. It’s all up to you: What kind of visual effect would you like to dream up?

Begin the challenge

To get started, download and open Swift Playgrounds on your iPad or Mac, then select See All from the lower right corner to launch the Swift Playgrounds content screen. From here, you can find the Shapes book under “Starting Points” and download a copy to your device.

Swift Playgrounds app showing downloadable books and challenges

The Shapes starting point has some great examples to reference as you get started. Check out the page “Shape Graphics” to explore the book’s basic API for creating all shape types and placing them in the scene. “Touches and Animations” will show you how to apply animations to shapes and use touch events to drive behaviors. And finally “Sprite Shapes” can help you learn how to set up physics interactions between different shapes. From there, you’ll have all you need to create your own visual composition.

Want to show off your visual concept to the community? You can share your creation (or creation-in-progress) on the Developer Forums.

Visit the Apple Developer Forums

Resources

Download Swift Playgrounds for macOS

Learn more about Swift Playgrounds

Read the WWDC21 Challenges Terms and Conditions

Posted on Leave a comment

Optimize your app for 5G

Wi-Fi and LTE have long helped apps deliver connected experiences like video streaming, social networking, and online gaming — and 5G networking can provide even more opportunities to take advantage of high-bandwidth and low-latency connections in your app. Discover how you can optimize your existing app or build a new product from the ground up with 5G in mind so that you can move more data faster and deliver a great experience to people around the world.

Up your 5G game

One of the best ways you can take advantage of 5G’s high-performance characteristics is to offer multiple versions of an asset depending on someone’s network connection. If a person using your app is on a lower-bandwidth connection, your app can download or deliver files appropriate for that network; likewise, you can deliver higher-bandwidth assets when the connection supports it so that you can provide more information quickly. You can apply this to multiple different types of apps, including:

Streaming apps Video streaming apps can incorporate intelligent buffering and playback with AVFoundation to serve 4K (or 4K HDR) content to devices on 5G networks as well as lower-bandwidth options when connected to LTE.

Learn more about AVFoundation

Games Use the bandwidth available on 5G networks to deliver higher quality visuals and game play with larger texture maps and higher-poly models than you might otherwise on lower-bandwidth networks. Additionally, 5G’s lower-latency connection provides for faster overall play and state-saving actions between players and your server backend.

Learn more about SceneKit

Machine Learning apps If your app uses Core ML, you can improve both the speed and reliability of your on-device intelligence when connected to a 5G network by automatically retrieving larger .mlmodel and .mlarchive files from your server to run locally on someone’s device.

Core ML

AR apps While on 5G, you can provide a greater number of high-resolution objects within your ARKit scenes to provide a richer augmented experience for people interacting with your app. You can also use the extra bandwidth available over 5G networks to share even larger ARWorldMap and ARPointCloud objects in a shared AR experience — for instance, working collaboratively to lay out physical spaces with virtual objects from your app.

ARKit

Tune your transfers

Apple networking APIs automatically provide optimized management and performance for each platform and network type. In addition, you can further optimize your app to address potential cellular issues like movement speed and direction, cellular infrastructure demand, and interference.

Forget the network Because 5G networks typically offer better performance than Wi-Fi, it’s up to you to decide how your app best utilizes network resources — and you no longer need to rely on overall network type (cellular or Wi-Fi) to do so. Instead, you can use Constrained and Expensive to describe various network states. Each of these states relies on information from a person’s Data Mode choices (as defined in Settings > Cellular > Cellular Data Options) as well as their cellular plan restrictions.

isExpensive

isConstrained

For example, the network automatically switches to Constrained when someone enables Low Data Mode. When a person’s network is listed as Constrained, your app should minimize network data usage regardless of the value of Expensive. If the network is Expensive but not Constrained, your app should be considerate when fetching network resources while not imposing strict restraints. If the network is neither Constrained nor Expensive, your app can focus on providing the highest quality experience with minimal consideration for data usage.

Each networking framework uses the Constrained and Expensive indicators in specific ways. When using URLRequest, for example, your app can indicate which resource should be retrieved by setting the appropriate value on the allowsConstrainedNetworkAccess and allowsExpensiveNetworkAccess properties. In contrast, when using NWConnection, your app can access the state of the network through stateUpdateHandler as the isConstrained isExpensive properties of your connection’s currentPath. And, if your app uses AVFoundation instead of the Network framework or URLRequest, there are similar keys including AVURLAssetAllowsConstrainedNetworkAccessKey and AVURLAssetAllowsExpensiveNetworkAccessKey.

Regardless of technique, remember that the values for Constrained and Expensive are transient and can change as someone moves from one type of network connection to another. If your app dynamically monitors these changes, you’ll always provide the best experience for people, no matter their connection.

allowsExpensiveNetworkAccess

prohibitExpensivePaths

Provide a fallback Unless your app is designed specifically for a network with guaranteed performance characteristics, like a corporate or private connection, you should always make sure it functions well — even when there’s no network available at all. When someone initially downloads your app, make sure it delivers acceptable-quality assets as part of the bundle. If the app has periods of fast connectivity, you can then download higher-quality files and store them locally to ensure they’re available when someone leaves network range or goes offline entirely.

Support your surroundings Most cellular providers have prioritized 5G rollouts in high-density areas: entertainment venues such as sports stadiums and amphitheaters, transportation hubs like train stations and airports, centers for business and education, and points of interest like public parks and tourist landmarks. When people recognize they’re in a high-performance networking location, they may want to explicitly enable caching and other features in your app before heading to a destination with reduced coverage — consider incorporating interface elements that notify and enable people to immediately download any relevant content

Take advantage of built-in frameworks Apple’s hardware and on-device frameworks are tuned to deliver advanced functionality in a power-efficient manner. For example, you can use Core ML for on-device intelligence instead of client-server round trips, or ARKit and the Vision framework for capturing, processing, and presenting insightful information in the field. On-device processing minimizes the need to exchange large amounts of data — let alone potentially personally identifiable information — and eliminates the need for having to connect to a back-end process in order to provide a useful service in your app.

When you do need to move large amounts of data, you can lean on Smart Data Mode for 5G-enabled devices. This feature monitors your app’s state along with any Apple frameworks you’re currently using to automatically switch between existing cellular frequencies in a manner that ensures your app receives the highest possible bandwidth — all without sacrificing battery life.

For example, when an app is in the foreground and playing video using the AVFoundation framework, Smart Data Mode ensures that high-bandwidth 5G is enabled. In addition, Smart Data Mode monitors the streaming experience while someone is connected to a 5G network. If the stream is throttled due to traffic shaping — either by the cellular provider or the limitations of your CDN — the feature will identify the throttled throughput and move the stream to an LTE connection to conserve power. Background requests for data using the core networking frameworks can be served just as well over LTE or lower power frequencies.

Get out there

Previously, testing your app’s networking code involved toggling the network state, switching between Wi-Fi and cellular data, and then using a network conditioner and other tools to alter various characteristics. While this is still a great way to test for basic use cases, nothing beats getting out and exploring the edge-case scenarios only a deployed network can throw your way.

Start small The App Store has a variety of apps you can use to determine the network characteristics for a given area. With one of these apps and a regional carrier’s wireless coverage map, you can track down the perfect spots in your area to ensure your app is selecting the correct resources at the right time. And once you’ve found that perfect 5G networking spot, move to another where your coverage is sub-optimal and check your app. Did it keep running? Did your streaming content degrade as expected or move to local resources? Did it deliver acceptable-quality assets after fresh install? The more real-world use cases you can test in advance, the better the experience overall will be for people around the world.

Go big While many third-party websites provide performance data for cellular networks, they are an aggregate statistic and only an approximation of the performance at the location where someone might be using your app. Because this data is only valuable as a baseline, it’s not a substitute for knowing how your app performs in the wild. You can use Testflight for iOS to scale your beta testing to people and networks around the world. You may also want to consider creating a TestFlight group — not only to ensure your app is bug-free, but that it performs well based on the overall network characteristics of the cohort you’ve assembled.

Move to the edge While the location of your server isn’t something you can always control, at least try to influence or decide where your server infrastructure resides and take steps to minimize the distance between your server and your app. When you reduce the distance between people and your backend, it can vastly improve the network performance of your app. One way you can improve your own app’s connection is by selecting a hosting provider that can federate your server back-end to map closely to the cellular networks your app uses. Alternatively, you may also want to consider using a few strategically-located CDNs.

Reach out

5G networks provide a real opportunity to enhance your existing app with richer data or build entirely new experiences that were previously not possible. If youʼre working on creating an amazing experience with 5G and would like to share it with us, let us know.

Contact us

Learn more about supporting 5G in your apps

Posted on Leave a comment

WWDC21 Daily Digest: Day 4

A Memoji staring into an open MacBook Pro

Welcome to day 4 of WWDC, or — as we’re calling it — Apple Design Awards day! We’ve got a fresh round of session videos, labs, challenges and some hardware to hand out later on, as well as lots of other fun activities in our pavilions and digital lounges. Read on.

And the Apple Design Award winners are…

… being announced this afternoon! Stream the live presentation of the Apple Design Awards starting at 2 p.m. PDT. (Virtual rounds of applause will be accepted.)

WWDC21 Apple Design Awards

WWDC21 Apple Design Awards (ASL)

Get all caught up

Missed any of the fun this week? No worries: Our official recap videos will get you caught up in no time.

Wednesday@WWDC21

Tuesday@WWDC21

Monday@WWDC21

Day 4 in the WWDC pavilions

Another set of great sessions, labs, and activities have arrived in the pavilions: Try out a Framework Freestyle in the Essentials pavilion and learn a new framework in 100 lines of code or less. Discover how to design memorable SharePlay experiences in the Audio and Video pavilion. Sign up for one of Friday’s design labs in the Design pavilion. And get a glimpse of a magnificent future without passwords in the Privacy & Security pavilion.

Design for spatial interaction

Design for Group Activities

Discover rolling clips with ReplayKit

Create image processing apps powered by Apple Silicon

Optimize high-end games for Apple GPUs

Challenge: Framework Freestyle

Build Mail app extensions

Swift concurrency: Behind the scenes

Learn to meditate (even if you’re fidgety)

At 11 a.m. PDT, hear from special guest speaker Dan Harris, an Emmy-winning journalist, Good Morning America anchor and author of the best-selling book Meditation for Fidgety Skeptics. After having a nationally televised panic attack in 2004, Harris found himself on a long and often bizarre journey that ended with the discovery of mindfulness meditation. Today, Harris will discuss his journey, as well as the books, podcast, and app that have helped millions manage the stress and anxieties of today’s world—including previous non-believers like himself. (Want a sneak peek? Check out Harris’s app Ten Percent Happier.)

Meditation for fidgety skeptics

Lock down a lab appointment

There’s still one more day to register for a lab appointment with Apple engineers, designers, and specialists for 1-to-1 guidance and conversation.

Until Day 5…

That’s it for today! But rest up — we’ve got one more big day for you tomorrow.

Posted on Leave a comment

Challenge: Framework Freestyle

Framework icon with a question mark on top of it on a yellow background

No matter your level of expertise, it can be daunting to step out of your comfort zone when you’re first learning about new frameworks or technologies. Our challenge today presents a fun and interactive way to encourage you to try something new with an ARKit sample app and one framework of your choosing. What can you create in 100 lines of code or less?

Begin the challenge

This challenge is a gamified Augmented Reality experience created with RealityKit and ReplayKit. To participate, you’ll need to have downloaded the developer beta for iOS 15 and Xcode 13. After you do, download the Framework Freestyle sample project from this challenge and open it in Xcode, then build and run the app on your iOS device.

When you engage with the app, it triggers a mystery sequence of Apple frameworks, randomly selecting one of them. Here comes the fun part: We’re asking you to build something new using whatever framework the randomizer lands on — and do so using 100 lines of code or less! For example, if it lands on SwiftUI, you could experiment in Xcode with the canvas, or try making a basic search bar with .searchable. Don’t worry too much about building something perfect: Use this challenge to break the ice, learn, and have fun.

Resources

WWDC21 Challenge: Framework Freestyle

Read the WWDC21 Challenges Terms and Conditions

Posted on Leave a comment

Challenge: Sense the world around you in Swift Playgrounds

Hammer symbol and paint brush symbol

Just like our senses, our devices constantly gather data from their environment, and can use that information to do interesting and important things. In this challenge, you’ll harness your iPad’s sensor data to create a visualization or experience of your choosing.

Begin the challenge

To get started, download and open Swift Playgrounds on your iPad, then select See All from the lower right corner to launch the Swift Playgrounds content screen. From here, you can find the Sensor Create book under “Starting Points” and download a copy to your device.

Swift playgrounds content on iPad

In this challenge, you’ll use the Sensor Create playground book to gather some data from the world around you. You can use audio data (frequency, volume) from the microphone, light data (color, brightness) from the camera, and also gyroscope data (movement in X, Y, Z coordinates) from the motion sensor of the device. The book has some great reference material to help you get started: Check out “Using Device Motion,” “Using Light to Play Sound,” “Clappy Fish,” and “Synesthesia.”

Think about the types of things you could decipher about your environment based upon this sensor data. Given this, how can you write some code that visualizes this information in interesting ways? For example, you could create an alarm that goes off when the volume around you is too high, or create a notification that displays when you quickly accelerate or decelerate, asking if you or your device has fallen. These are just examples: Use your imagination and come up with an idea you love!

Resources

Download Swift Playgrounds for iOS

Learn more about Swift Playgrounds

Read the WWDC21 Challenges Terms and Conditions

Posted on Leave a comment

Challenge: Design a quiz in Swift Playgrounds

Hammer symbol and paint brush symbol

Do the people in your life know your favorite animal noise? How about the book that changed your life? Your least favorite pizza topping? Design a “How well do you know me?” quiz to see who knows the most about your quirks and interests.

Begin the challenge

This challenge invites you to create a quiz using the Answers book in Swift Playgrounds. Your “How do you know me” quiz should ask a series of questions and ultimately return a score (and possibly a colorful description!) based upon how many questions were answered correctly.

To get started, download and open Swift Playgrounds on your iPad or Mac, then select See All from the lower right corner to launch the Swift Playgrounds content screen. From here, you can find the Answers book under “Starting Points” and download a copy to your device.

Use the Swift Playgrounds app to download the Answers book for this challenge.

Use the Swift Playgrounds app to download the Answers book for this challenge.

The Answers starting point contains a page called “API Overview,” which dives into the API for this playground. You can use the show call to display text or images, and use several different ask calls to request feedback from the player and store their response as variables. You can use the combination of these API calls to build up your own custom quiz questions and check responses against your own answer key.

You can use Answers to build all sorts of different text-based trees and quizzes, and if you feel strongly about making a different type of quiz, please do! We highly encourage you to explore different ways of using this starting point to make something that you’re excited about. And if you’d like to share what you’ve built with the community, post a video of your quiz in action or share a link in the Developer Forums.

Visit the Apple Developer Forums

Resources

Download Swift Playgrounds for macOS

Learn more about Swift Playgrounds

Read the WWDC21 Challenges Terms and Conditions

Posted on Leave a comment

Challenge: Achievement Unlocked – Fabulous Fails

Achievement symbol with an achievement icon that looks like a x-mark in a circle.

When you create achievements that truly surprise and delight your players as they make their way through a game, you can help elicit a feeling of accomplishment, or even make the player laugh. Most of us have experienced playing games where we have unlocked some kind of achievement or trophy that stirs some of these emotions. This is exactly what we want you to consider when you create Game Center achievements for your apps or games — and now, we’re challenging you to show the developer community your best, funniest, strangest, and most delightful achievements.

Begin the challenge

For this challenge, we’re inviting you to share or create an achievement that rewards people for not coming out out top. Perhaps they’ve failed in a spectacularly short period of time or ended up going out in a hilariously fun way. Maybe they were a bit too curious about tapping that button. Sometimes failing can be just as fun as winning — and however they’ve failed, it’s time to show off how you reward them for it.

We welcome all achievements, new, old, existing, or imaginary: Show off an existing “failure” achievement from your app or game, or put your wordsmithery to work and create an entirely new one. You can share your best “failure” achievement with the developer community on the Developer Forums.

Best of all, we’ve made it easy for you to participate and dream up awesome achievements even if you haven’t yet implemented Game Center or you want to try something entirely new: Just download the attached Game Center achievement template.

Visit the Apple Developer Forums

Best practices for great achievements

It’s a lot of fun to create unique and engaging achievements to connect people with your app or game. Below are a few of our recommendations when thinking about writing and designing achievements.

Be creative with an achievement’s title, but straightforward with its description
Although most people appreciate entertaining titles, they expect an achievement’s description to specify how to earn it. If you were to create a WWDC21 achievement, for instance, you might write the following:

Title: Code Completionist
Description: Watched every WWDC21 Code-Along session.

Be succinct
The Game Center achievement card limits your title and description to two lines each before truncating the text — brevity is key to a great achievement.

Think inclusively
Follow the Human Interface Guidelines around inclusivity when creating achievements. The best jokes, puns, and wordplay are those that are intuitive and friendly to everyone who might interact with your app or game, and make players feel recognized and rewarded.

Add unique, high-quality images
People appreciate earning unique achievements that remind them of each accomplishment. When you create custom artwork, you can help that achievement stand out from the others in your app or game and make it more recognizable to people who interact with it.

You can learn more about how to design great achievements in Apple’s Human Interface Guidelines, and in the WWDC20 session “Design for Game Center.”

Design for Game Center

Get your game’s interface ready for Game Center. We’ll show you how to deliver personalized touches to the GameKit interface that provide a rich experience for players, with features like achievements, leaderboards, and multiplayer gaming. Learn how to customize your game’s access point, design…

Download the Achievement Unlocked Challenge material

Learn more about designing achievements

Read the WWDC21 Challenges Terms and Conditions

Posted on Leave a comment

Challenge: Throwback with SwiftUI

Pencil drawing a MacOS window

Whether you’ve been coding for 40 years, you’re new to the SwiftUI scene, or you’re a designer — everyone loves a good throwback. Give in to the nostalgia and imagine what your app might look like if designed for the Mac or iPhone interfaces of yesteryear. Are you a fan of the refreshing feel of 2000s-era Aqua? Perhaps you prefer the iconic grayscale of System 6. Or maybe you’ve been hoping for a return to the early days of iPhoneOS skeumorphism. Now’s your chance: Travel back in time with us and design a SwiftUI view that embraces that retro styling.

Begin the challenge

Before you travel through time, it’s important to choose your digital companion: are you designing a view for an existing app, or bringing an entirely new view idea along for the ride? Once you’ve decided, it’s time to fire up Xcode. Use your favorite random number generator to choose a year between 1984 and 2013 — or if you like, open up a Swift Playground to take you back in time:

let myCoolRetroYear = Int.random(in: 1984..<2013)
print("Reimagine your app's interface like it's from the year \(myCoolRetroYear)!")

Once you’ve settled on a year, begin imagining your interface with the Apple Design Languages prominent during that time! For designers and those newer to the world of code, explore how much UI you can create with the help of Xcode Previews. And when it’s time to start adding code, see how simple and fun SwiftUI makes it. For seasoned code warriors, further your SwiftUI knowledge and explore the new features of SwiftUI that will take your recreated artifact to the next level.

Want to share your work-in-progress or collaborate with other developers? You can show off your finished design in the Developer Forums.

Visit the Apple Developer Forums

Resources

Introduction to SwiftUI

Explore the world of declarative-style programming: Discover how to build a fully-functioning SwiftUI app from scratch as we explain the benefits of writing declarative code and how SwiftUI and Xcode can combine forces to help you build great apps, faster.

Read the WWDC21 Challenges Terms and Conditions

Posted on Leave a comment

Challenge: Speech Synthesizer Simulator

AVSpeechSynthesizer is the engine that helps generate synthetic speech on iOS. Screen readers like VoiceOver rely on speech synthesis to help communicate information about items on the screen. It’s a foundational aspect for assistive technology, and a valuable tool for creating accessible apps and augmenting existing experiences for people and those who uses assistive technology.

We’re inviting you to take AVSpeechSynthesizer for a spin out into the world. Using our ARKit-powered sample app, design a conversation between two animated birds, powered entirely by speech synthesis. You pick the scene, and the script.

Begin the challenge

To join this challenge, download the sample project and add the app to your iPhone. Choose where you want to film your conversation, as well as the tone and style. And don’t forget a set of dynamic and entertaining dialogue.

WWDC21 Challenge: Speech Synthesizer Simulator

Your scene could be an exchange between friends, a romantic comedy, or even an award-winning drama. While AVSpeechSynthesizer can read any string, keep your scenes respectful and inclusive. There’s no limit to what you can make, and we’re looking forward to learning what brilliant and funny scenes you create. And, for a bit of extra fun, try exploring some of the synthesizer properties to achieve different tones and inflections!

Once you’ve staged and directed your scene, do a screen recording and share your creation with the developer community. You can also share your progress on the Developer Forums.

Visit the Apple Developer Forums

Resources

AVSpeechSynthesizer: Making iOS Talk

Speech can enhance the audio experience of your app, whether you are generating spoken feedback for accessibility, or providing critical information beyond simple alerts or notifications. AVSpeechSynthesizer produces synthesized speech from text and allows you to control and monitor the progress of…

Create a seamless speech experience in your apps

Augment your app’s accessibility experience with speech synthesis: Discover the best times and places to add speech APIs so that everyone who uses your app can benefit. Learn how to use AVSpeechSynthesizer to complement assistive technologies like VoiceOver, and when to implement alternative…

Read the WWDC21 Challenges Terms and Conditions

Posted on Leave a comment

Challenge: Large Text

Text adjustments over blue bg

Dynamic Type allows people to choose the size of textual content displayed on the screen. You can use this feature to help people who prefer larger text to enhance their readability experience. Additionally, you can do something similar for those who prefer smaller text, allowing more information to be presented on screen. When designing apps to support Dynamic Type, it’s important to keep the adaptability of your interface in mind: This allows people to have a great experience with your app, no matter their preferred text size.

Begin the challenge

We’ve prepared a sample app for you in which some UI Elements are defying our layout and wreaking havoc with text throughout the app. These elements are causing text to become truncated, go off screen, and sometimes even forcing other text elements to be hidden. With the help of an astounding magic tap, however, you can modify the elements on the screen. UI Elements react to your Magic Tap by asking how they should change their behavior, and will update based on your choices. Explore various scenarios, helping to get the UI Elements in line and make your text readable once more.

WWDC21 Challenge: Large Text Challenge

As you go through these exercises, here are a few good questions to ask:

  • Should this text be truncated or should it wrap at the boundary?
  • Are there images that are growing too large in size?
  • Are we able to scroll to view all text that’s being presented?

These sorts of questions are also great starting points when considering how Dynamic Type may behave in your own app. Once you’ve completed the challenge, we encourage you to explore this project in Xcode and view how we support Dynamic Type in each scenario. We then encourage you to look at your own app — can you apply these concepts to your own project?

Resources

Scaling Fonts Automatically

Read the WWDC21 Challenges Terms and Conditions