Overlay

Overlays are a semi-transparent layer between an image and text to make copy easier to read.

Backpack-SwiftUI/Overlay

Cocoapods class reference view on Github

Solid

Requires a level to be set.

Day Night

                                                
                                                Image("image")
                                                    .resizable()
                                                    .frame(width: 200, height: 200)
                                                    .bpkOverlay(.solid(.high))
                                                    .cornerRadius(8)

Linear

Requires a level to be set, as well as a direction.


                                                
                                                Image("image")
                                                    .resizable()
                                                    .frame(width: 200, height: 200)
                                                    .bpkOverlay(.linear(.high, .leading))
                                                    .cornerRadius(8)

Top

Day Night

Bottom

Day Night

Leading

Day Night

Trailing

Day Night

Vignette


                                                
                                                Image("image")
                                                    .resizable()
                                                    .frame(width: 200, height: 200)
                                                    .bpkOverlay(.vignette)
                                                    .cornerRadius(8)
Day Night

Usage

BPKOverlay provides the bpkOverlay(BPKOverlayType) View modifier that can be used to add an overlay to any view.


                                                
                                                import Backpack_SwiftUI
                                                
                                                var body: some View {
                                                    Image("image")
                                                        .resizable()
                                                        .frame(width: 200, height: 200)
                                                        .bpkOverlay(.solid(.high))
                                                        .cornerRadius(8)
                                                }