Dave G Dave G - 2 months ago 90
Swift Question

Xcode 8 - Some Views & VCs Not Showing Up on Simulator

The app ran perfectly prior to updating to Xcode 8 Beta 6 and Swift 3. I've changed nothing else but now I have two problems.

First, a few random views are no longer showing up. They're just square, colored boxes. The views above them show up though.

In Interface Builder:


On simulator:

Only locks on simulator

Second, my model VC is no longer appearing when segued. It did before and I can see the segue is being called but now its' not there.

If anyone can provide ideas about either problem it'd be greatly appreciated.


So between Xcode 7/Swift 2 --> Xcode 8/Swift 3, something changed with how to turn a UIView into a circle. Here is my code now:

func roundView (_ viewToRound: UIView) {
    viewToRound.layer.cornerRadius = 20
    //viewToRound.layer.cornerRadius = (viewToRound.frame.width/2)
    viewToRound.clipsToBounds = true

As you can see, I've replaced my cornerRadius method to be an explicit "20" instead of inferred from the view size. With my previous "frame.width" the views were literally not showing up at all. Now they're back to normal. I don't know what changed but this definitely fixed it.