I got an error message when function "thumbnailCount" is called:
Main Thread Checker: UI API called on a background thread: -[UIView frame][...]
Apparently, just calling this function inside the main thread seems to eliminate the error message.
I'm running on Swift 4, Xcode 9.2.