> On 30 Nov 2023, at 22:36, Enellis via skim-app-develop 
> <skim-app-develop@lists.sourceforge.net> wrote:
> 
> Hi,
> 
> I have noticed that the PDF view is empty for a short time during reloading 
> while I was using the automatic reload function. After some research I found 
> out that this is due to an artificially created delay in PDFKit. With the 
> following change by directly using the undocumented method [PDFView 
> setDocument:waitDuration:], which is called internally when using [PDFView 
> setDocument:], the PDF view reloads the document almost immediately. (It 
> works like a charm used alongside Typst's incremental pdf builds created 
> instantly while typing.)
> 
> Index: SKPDFView.m
> ===================================================================
> --- SKPDFView.m (Revision 13817)
> +++ SKPDFView.m (Arbeitskopie)
> @@ -607,7 +607,7 @@
>     if ([self document])
>         [self unregisterForDocumentNotifications];
> 
> -    [super setDocument:document];
> +    [super performSelector:@selector(setDocument:waitDuration:) 
> withObject:document withObject:0];
> 
>     if (document)
>         [self registerForDocumentNotifications];
> 
> I don't know whether this is suitable for production, but I wanted to let you 
> know.
> 
> Cheers,
> Enellis



That’s not a good idea. That method its not documented, so we don’t know how it 
works, what side effects it has, and whether it exists in the first place. It 
may work for you. It may work now. But in the next OS version? You have no 
idea, and you cannot do. We sometimes do use private methods, but it is to work 
around bugs in the system, or to do things that are otherwise impossible. It is 
not a good idea to use it to make things a little bit nicer.Because usually, it 
will break you up and lead to a serious bug in the future. Speaking from 
experience.

Christiaan

_______________________________________________
skim-app-develop mailing list
skim-app-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-develop

Reply via email to