Surface Swift

Neumorphic shadow example:

let view = SurfaceView()
view.frame = ...
view.layer.cornerRadius = ...
view.surfaceLayer.shadow = Shadow(preset: .convex1)
view.surfaceLayer.useDeviceMotionToCastShadow = true
addSubview(view)

The cast shadows moves accordingly to the device horizontal axis.

screen

Convex/Concave shadow example:

view.backgroundColor = systemBackground()
let surface = SurfaceView()
surface.frame = CGRect(x: 100, y: 100, width: 96, height: 32)
surface.layer.cornerRadius = 16
surface.surfaceLayer.shadow = Shadow(preset: .concave2)
view.addSubview(surface)

let button = SurfaceView()
button.frame = CGRect(x: 0, y: 0, width: 48, height: 32)
button.layer.cornerRadius = 16
button.surfaceLayer.shadow = Shadow(preset: .convex1)
button.backgroundColor = .white
surface.addSubview(button)
screen

Surface

A set of utilities and extensions to create depth in your views by using complex shadows.

Surface Info

⭐ Stars 15
🔗 Source Code github.com
🕒 Last Update a year ago
🕒 Created 2 years ago
🐞 Open Issues 0
➗ Star-Issue Ratio Infinity
😎 Author alexdrone