HKWorkoutSession documentation inline sample code outdated

Originator:SlaunchaMan
Number:rdar://31579816 Date Originated:12-Apr-2017 11:51 AM
Status:Open Resolved:
Product:Documentation Product Version:n/a
Classification:Serious Bug Reproducible:Always
 
Summary:
The sample code for HKWorkoutSession has inline code listings for creating workout sessions, saving their data into HKWorkout samples, etc. This code has not been updated for watchOS 3 and Swift 3.

Steps to Reproduce:
1. Copy the code from the documentation to an Xcode 8.3.1 watchOS project using Swift 3.
2. Build the app.

Expected Results:
The app compiles.

Actual Results:
There are several compilation errors, from renamed methods and enums from the Swift 3 naming conversion to deprecated methods, like obtaining the activity type directly from the workout session.

Version:
HKWorkoutSession
https://developer.apple.com/reference/healthkit/hkworkoutsession

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!