UIView flickering in a simulator coming from a playground

I have a playground, Xcode 6.3 (6D543q). Therefore Swift 1.2

The playground imports XCPlayground. I create a UIView and call XCPShowView () so that it appears in the simulator, and not on the playground. I also present UIAlertView in the same way.

UIAlertView looks as usual. The UIView flickers between the larger and smaller sizes about 5 times per second, reasonably irregularly. I tried resizing it to fit the borders of the screen, but no luck.

Code below ....

// Playground - noun: a place where people can play import UIKit import Foundation import XCPlayground XCPlayground.XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true) @objc class alertHandler: NSObject, UIAlertViewDelegate { func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) { if buttonIndex > 0 { // View things.... let redRectangleFrame = CGRect(x: 0, y: 0, width: 200, height: 200) let redRectangle = UIView(frame: redRectangleFrame) redRectangle.backgroundColor = UIColor.redColor() redRectangle.setTranslatesAutoresizingMaskIntoConstraints(false) XCPShowView("Red Rectangle", redRectangle) // Alert view things... let recevingAlertView = alertView let text = alertView.textFieldAtIndex(0)?.text println("\(text!)") println("Button \(buttonIndex)") } } } let anAlertHandler = alertHandler() let status = "Hey there!" let message = "Do you have a moment to talk about our Lord and Saviour, Cthulhu?" let cancel = "Sounds wierd" let ok = "Oooh! Yes" let alert = UIAlertView(title: status, message: message, delegate: anAlertHandler, cancelButtonTitle: cancel, otherButtonTitles: ok) alert.alertViewStyle = UIAlertViewStyle.PlainTextInput alert.show() XCPShowView("Alert", alert) 
+6
source share
1 answer

We noticed some flickering locally with several examples of test site simulators (your example was a failure for me Version 6.3.2 (6D2105))

From this post (their animation appeared, but flickered and overlapped)

There are some restrictions and feedback from UIKit on playgrounds. The main limitation is that in Auto Layout there are some problems when used in Playgrounds. Some restrictions will throw runtime exceptions in addition to increasing compilation time. We hope that future updates to Xcode will resolve this. Another rollback is the performance of playgrounds when using XCPlayground. There may be delays, since Xcode works with iOS Simulator works behind the playground.

+1
source

Source: https://habr.com/ru/post/983936/


All Articles