So I've now converted my project to use Swift 4 in Xcode 9, and have started testing my app. It's a big app with four distinct tabs, and nearly everything is working as expected. One of the tabs is a map, using GoogleMaps. I have never had any trouble with it, but when built with Xcode 9 and shown in Simulator, it uses over 100% of CPU when moving the map, and it lags very much. Here is the debug navigator when running on a simulator. We do some custom drawing, but not 102% worth of drawing.
This only started happening after I updated to Xcode 9 and Swift 4. When debugging in Xcode 9 on an iPhone 7, 8 or X simulator, all with iOS 11, it goes just over 100% CPU, and it completely stops the UI from updating for about one second each time I try to move it. I start the drag-gesture, but the UI only updates once a second. Effectively giving me about 1fps.
However, when debugging in Xcode 9 on an iPhone 6 simulator with iOS 9, it gets up to ~90% when moving the map and not lagging nearly as much. I'm guessing I get about 20-30 fps here. (This might be the same fps I get in simulators on Xcode 8. Map has never been really smooth on simulator..)
When running on an actual device (iPhone 7, iOS 11), the CPU uses about 40% when constantly moving the map, and is working very smooth with no lags at all (60fps).
I also get this in the output as soon as I open the tab with the map, but I think it's irrelevant to this particular question:
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: *****, TID: *******, Thread name: com.google.Maps.LabelingBehavior, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
This says that GoogleMapsAPI calls [UIApplication applicationState]
on a background thread..
I am using the latest version of GoogleMaps: 2.4.0. As far as I know, this version may not support Xcode 9/Swift 4 etc, but I can't find anything about a new version.