The first thing to understand is what's actually taking up all that time. You're assuming here that the problem is actually writing the data to disk:
Is there any better way to handle this because every time I tried to close the file, it took really long time to save a 100MB file and the app block the main thread(probably because UIDocument is a library from UIKit)?
...but that is definitely not the case. These day, 100 MB just isn't very much data. Something like a REALLY slow USB thumb drive will still do 20+ MB/s, which means the I/O time is only going to be a few seconds.
The issue with here isn't writing the data itself:
So in a case, we need to store the PDF file, although the user only added 1 small update to the file like adding ink or an image annotation, we have to rewrite 100% the PDF file to store it on disk?
...it's generating the data you're going to write out. That's what he was talking about here:
For example if your generating a lot of images (which would also be the case if you did something like calling CALayer.render(in:) or UIView.drawViewHierarchy(in:afterScreenUpdates:) to draw the content) then it will indeed take a very long time to render and safe a large document. PDF is natively a vector graphics format and performs best when storing that kind of content.
That's just a simple example of the broader issue, which is that you need to speed up the process of actually generating the data you're writing to disk.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware