Skip to content

Instantly share code, notes, and snippets.

@bubudrc
Created July 3, 2020 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bubudrc/6686bd151d3212d38de61dd2b60d3223 to your computer and use it in GitHub Desktop.
Save bubudrc/6686bd151d3212d38de61dd2b60d3223 to your computer and use it in GitHub Desktop.
Full mock for iPhone 11 lock Screen
import SwiftUI
import PlaygroundSupport
struct Screen: View {
@State var fontColor: Color = Color(.black)
var body: some View {
VStack{
Spacer(minLength: 42)
//Top View
HStack { //Notch
Text("Carrier").foregroundColor(fontColor).font(.system(size: 14))
Spacer()
Image(systemName: "dot.radiowaves.right").foregroundColor(fontColor).font(.system(size: 14))
Image(systemName: "wifi").foregroundColor(fontColor).font(.system(size: 14))
Image(systemName: "battery.100").foregroundColor(fontColor).font(.system(size: 14))
}.padding([.leading, .trailing], 47)
Spacer(minLength: 26)
//Lock View
Image(systemName: "lock.fill").font(Font.system(.largeTitle)).foregroundColor(fontColor)
ScrollView {
//Date & Time
VStack {
Text("5:45").font(.system(size: 64, weight: .thin)).foregroundColor(fontColor)
Text("Monday, May 11").font(.system(size: 24)).foregroundColor(fontColor)
}.padding(.vertical, 32)
//Notifications
VStack {
VStack(alignment: .leading) {
HStack {
Rectangle().frame(width: 16, height: 16).foregroundColor(Color(UIColor.systemFill)).cornerRadius(4)
Text("APP NAME").font(.caption)
Spacer()
Text("21m ago").font(.caption)
}
Text("Notification title").font(.headline)
Text("This is the notification body")
}.padding().background(Color(UIColor.secondarySystemBackground)).cornerRadius(12)
}.padding([.leading, .trailing], 47)
}
Spacer()
HStack {
Button(action: {
//
}) {
Image(systemName: "flashlight.on.fill").foregroundColor(.white).font(.system(size: 24)).background(Circle()
.fill(Color.gray.opacity(0.75))
.frame(width: 50, height: 50))
}
Spacer()
Button(action: {
//
}) {
Image(systemName: "camera.fill").foregroundColor(.white).font(.system(size: 24)).background(Circle()
.fill(Color.gray.opacity(0.75))
.frame(width: 50, height: 50))
}
}.padding([.leading, .trailing], 87)
Spacer(minLength: 82)
}
.background(Image(uiImage: #imageLiteral(resourceName: "iPhone11-Light.png")).resizable())
.frame(width: 437, height: 867, alignment: .center)
}
}
PlaygroundPage.current.setLiveView(Screen())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment