
Building iPad Pro features in Swift - ingve
https://www.swiftbysundell.com/posts/building-ipad-pro-features-in-swift
======
clay_the_ripper
I just don’t see how an iPad Pro could ever really work as a computer
replacement for true professional workflows. I’m talking about multitasking
between final cut, building a website, creating assets in photoshop, taking
screenshots, downloading things from an email...these are daily tasks for me.
An iPad would struggle to do one of these at a time let alone all of them at
once. iOS is just too limited to ever make it a real “pro” machine. For
limited things like a photography workflow or photoshop workflow, maybe, if
that’s all you do. So I think it’s time to give up on the idea of an iPad as a
true pro machine. It will never replace your laptop and Apple doesn’t want it
to. It’s a shame though because the hardware is certainly capable enough. It
would require Apple basically throwing out iOS for iPad and designing a whole
new way of interacting just for iPad. iOS is great for iPhones but not great
for professional applications. It would be cool, but I doubt Apple will do it.

~~~
djrogers
> An iPad would struggle to do one of these at a time let alone all of them at
> once.

You haven’t touched a modern iPad, have you? Not only do they not ‘struggle’
to do one of those at a time, they’re butter smooth at it. The workflow/task
juggling aspect is definitely an issue, but there is _nothing_ preventing an
A10x or A12x iPad from doing any of those things with all the performance
you’d expect from a $3k+ MacBook Pro.

~~~
kccqzy
GP is talking about how the design of iOS is preventing one from doing all
those tasks in a satisfactory way, but not the hardware.

For example I could be editing a movie and waiting for it to export. Then I
switch to a different app and start editing my photos. There is a Task
Completion background API to allow the former to continue to run, but there is
no guarantee nor any notification when iOS decides my new photo editing app is
consuming too much resources and jettison or kill the movie app. It
contributes to this nagging feeling of needing to switch back to the
background app so that iOS would keep it alive.

It's just an app management model ill suited to professional work.

~~~
saagarjha
As a workaround, you can put the app into split screen and the OS will keep it
alive because it is still in the foreground.

~~~
binomialxenon
Seems like trying to do anything serious on an iPad is a story of one
workaround after another. Why would it be worth the hassle?

~~~
saagarjha
It's thin, light, and has better specs than my laptop?

------
eridius
Using UIPanGestureRecognizer for gestures that should be recognized
immediately on touch down is a common mistake I see a lot of people make. The
problem is UIPanGestureRecognizer doesn't actually start recognizing until the
touch has moved a short distance, and at this point, you can't recover the
original touch location, only the location at which the gesture recognizer
began recognizing.

The solution is to use a UILongPressGestureRecognizer with
minimumPressDuration set to 0. With this configuration, it will begin
recognizing immediately on touch down, allowing you to take action even before
the user has moved their finger (or pencil).

~~~
yargg
How do you track the translation during the gesture if you use
UILongPressGestureRecognizer? Do you have an example you can link too?

~~~
eridius
Admittedly you do lose the convenience methods from UIPanGestureRecognizer
(sure would be nice if Apple would add them to UILongPressGestureRecognizer
too), but you can recover translation just by grabbing the location of the
recognizer in the associated view when the state moves to .began and then
subtracting that from the current location on every subsequent .changed state
callback. Calculating velocity is harder of course, but you could do it
without too much difficulty by recording the previous location and timestamp
and using that to calculate an instantaneous velocity (I'm not sure if this is
what UIPanGestureRecognizer does or if it tries to smooth the velocity at all
using multiple "frames").

I don't have any linkable examples offhand, but at a previous company one of
our standard interview questions was to implement custom drag & drop of a view
using a gesture recognizer, and our reference app used
UILongPressGestureRecognizer because it let us do such nice things as visually
"lift up" the view (scale it up slightly and add a drop shadow) the moment
your finger touched it.

~~~
dangwu
That’s an incredibly specific interview question... there’s a lot more to iOS
development than drag and drop. How has it fared for you?

~~~
eridius
Actually quite well. The fact that it's drag & drop is pretty irrelevant,
except in that it's not something the interviewee has likely done before
because it's not a very common thing to interrupt.

What's more important is that it's fairly basic usage of UIGestureRecognizer
(which _is_ a common thing to need, at least if you're doing any kind of UI
development) as well as some basic management of state involving 2 views (the
view being dragged, and the destination view it's dropped into).

~~~
eridius
s/interrupt/implement/

------
jbigelow76
Cool hardware, but there's no way I could justify the price to myself with the
limited functionality of iOS as it stands today. A lot Apple tech
writers/podcasters keep saying "just wait for iOS 13!", but the earliest a
developer is going to see iOS 13 is 6 months from now at WWDC, the earliest
the general public will get any additional functionality is 11 months from
now. That's a LONG wait to see if any changes will be made to make these
capable of doing real work for all but artistic professionals.

~~~
giobox
I think given the specifications of these devices, the pricing, while
definitely high, is not completely unreasonable for what the hardware can do -
these iPads do things no currently shipping Mac notebook can - 120hz refresh,
240hz touch/pen tracking, FaceID, performance in similar ballpark to a $3k
MacBook Pro while passively cooled (!) etc etc.

It’s just such a shame iOS isn’t quite ready yet to provide the kind of
computing experience the hardware is clearly capable enough to deliver. If
this is going to be priced like a macOS machine, it needs to offer a
reasonable set of Mac style functionality - for me this means proper multi-
user support so my family can all use the device with their own accounts and
services and ideally some kind of windowing model for the OS to better handle
multi-tasking.

iOS will need to answer a lot of questions in the next few years that it has
so far steadfastly avoided. Apple bragged how these iPads can drive 5k
monitors via an Xbox one S performance class GPU, but without indirect input
methods (e.g. a mouse) this feature is really not much use for anything other
than display mirroring. Today I only ever use video out on iOS devices for
occasional video playback on TVs, I suspect I’m not alone in this.

iOS will likely either need to support a mouse or Apple will have to create
some kind of standard for multi-touch external monitors that can allow iOS
application input via touch on the external display if professional class
workflows using multiple monitors on iOS is ever going to be a mainstream
thing the way it is on the Mac.

~~~
jbigelow76
_I think given the specifications of these devices, the pricing, while
definitely high, is not completely unreasonable for what the hardware can do -
these iPads do things no currently shipping Mac notebook can - 120hz refresh,
240hz touch /pen tracking, FaceID, performance in similar ballpark to a $3k
MacBook Pro while passively cooled (!) etc etc._

Totally agree, and if they had XCode or a decent native C# IDE on there I'd be
at an Apple store right now forking over fist fulls of cash.

~~~
pjmlp
Regarding C#,

[https://itunes.apple.com/us/app/continuous-net-c-and-f-
ide/i...](https://itunes.apple.com/us/app/continuous-net-c-and-f-
ide/id1095213378?mt=8)

------
sxp62000
When it comes to programming, I just can't see myself typing thousands of
lines of code on a tiny iPad screen, no matter how clever the gestures and
multitasking in iOS gets.

Maybe one day the iPad Pro + stylus will do wonders for visual programming
languages like VVVV (can't think of any others).

~~~
saagarjha
> When it comes to programming, I just can't see myself typing thousands of
> lines of code on a tiny iPad screen

iPad Pro has a 13 inch screen; that’s the same size as my MacBook Pro’s
display. With a good keyboard, such as the one Apple sells, I don’t see why it
should be difficult to write code in an iPad.

~~~
ken
I find it difficult to write code on even a _15_ -inch MBP display. It feels
very cramped to me. There's barely room for 2 adjacent windows, so I spend all
my time scrolling and switching desktops and re-layering windows.

13" is barely bigger than the 12" display on my Apple IIgs (late 1980's), or
my first laptop (mid-1990's). That was a perfect size for a VT100 emulator
(it's the same size as the original 1978 VT100!), but that's not how I write
software any more.

The same size screen is actually relatively worse than 20 years ago, because
these days all documentation is online, so it has to share my screen.

~~~
arvinsim
Same here. It's painful to write code in the 13" screen that I always connect
to an external display if one is available.

------
saagarjha
> To avoid having to re-create the same key commands multiple times, and to
> only do so when actually needed, we’ll use a lazy property to keep track of
> them internally as well

Honestly, I think this is a premature optimization. I don’t think it’s worth
trying to prevent the allocation of a four element constant dictionary,
especially one which requires awkward syntax (indirection through a computed
value) to work because it must fulfill a protocol requirement.

------
arkw
I can imagine that Apple is ready to release an OS for the iPad with the full
functionality (file system, mouse & cursor) and would do so in the event of
the more expensive and port-lacking new Air undersells. Wouldn't surprise me
if they had it ready as a backup plan, especially seeing the success of tablet
computing with the MS Surface.

~~~
giobox
> especially seeing the success of tablet computing with the MS Surface.

MS Surface sales last quarter: 602,000. iPad sales last quarter: 9.6 million.
Even the Mac shifted over 5 million machines, all the more impressive when one
considers that for much of that quarter staple models such as the Air were
long, long overdue a refresh. The Surface sales figure presumably includes
models that aren’t even tablets - the “Surface Laptop” is likely one of their
best sellers I’d assume, given the attractive combination of price, design,
specs and generally positive reviews.

While I too would love to see the features you suggest in iOS, Apple’s success
in the tablet space is largely unprecedented for a computer manufacturer.

~~~
empath75
I find it so weird that people continually talk about apple as if it’s
producing one failure after another and they need to start copying less
successful products, when it’s the largest company in the world and has more
profits by far than any of their competitors in any market they’re in.

------
dep_b
Great article again. Sundell is quickly becoming one of my favorites besides
mainstays like objc.io

------
throwaway487548
What a language!

