I'm using WatchConnectivity to transfer files from Apple Watch to iOS device (this direction). Transfer itself is ok. I send file from Apple Watch by calling transfer file function:
session?.transferFile(url, metadata: metadata)
and I'm able to save a file on iOS device. But I would like to show progress of transfer to the users on iOS device. For example user tap button "Download file" on iPhone and I would like to show some UI progress bar. Is this possible? Because I found only this delegate which is called when transfer is done:
func session(_ session: WCSession, didReceive file: WCSessionFile) {
}
The
WCSessionFileTransferinstance returned byhas a
NSProgress *progressproperty, you can use it to monitor the progress at Watch App w/ aNSTimerinstance, and send live message (WCSession-sendMessage:...) to iPhone App to update related UI elements.Note:
The
progressis only available since iOS 12.0 & WatchOS 5.0.