Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an equivalent class to UIView in WatchKit?

I have an iOS app that dynamically draw shapes on UIView (through drawRect), and I am looking at the possibility to port that app (or a small part of that) to Apple Watch. Unfortunately, after read through relative posts I cannot find which class can handle the similar job in WatchKit.

So the question is:

  1. If there is a similar class like UIView, in WatchKit, to draw lines cycles on Apple Watch?

  2. What is the best (possible) way to implement a simple drawing function on Apple Watch, if there is no UIView like class. (Assume this is achievable)

Thanks in advance.

like image 360
Will Avatar asked Apr 28 '15 12:04

Will


1 Answers

  1. No, there is no class similar to UIView in WatchKit
  2. You can generate images and transfer them to Watch App using WKInterfaceImage's func setImage(image: UIImage?)
    • If you already have drawing code for drawing in -drawRect:, it shouldn't be that difficult to modify it to support drawing to image
like image 124
Lukas Kukacka Avatar answered Oct 14 '22 10:10

Lukas Kukacka