Skip to content

[SR-9783] Playground live view doesn't render radial CAGradientLayer correctly #61

Open
@swift-ci

Description

@swift-ci
Previous ID SR-9783
Radar None
Original Reporter kerrmarin (JIRA User)
Type Bug

Attachment: Download

Environment

2018 13" macbook pro, OSX Mojave 10.14.3 (18D42)

Xcode Version 10.1 (10B61)

Additional Detail from JIRA
Votes 0
Component/s Xcode Playground Support
Labels Bug
Assignee None
Priority Medium

md5: bc7fb19603f6a839c3e7f241cf714cb9

Issue Description:

With a simple playground showing a radial gradient, playgrounds doesn't display the correct gradient (see attached screenshot)

import UIKit
import PlaygroundSupport
let colors: [UIColor] = [.blue, .orange]
let view = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 300, height: 300)))
view.backgroundColor = .white
let gradientLayer = CAGradientLayer()
gradientLayer.frame = view.bounds
gradientLayer.colors = colors.map { $0.cgColor }
gradientLayer.type = .radial
view.layer.addSublayer(gradientLayer)
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = view

Expected:

The live view will show the correct gradient

Actual:
A weird visual artifact (correct colours but not the gradient)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions