Ahoy there, everyone,
Slowly but surely I keep finding some time to work on my new app. It’s amazing how much time such a young dog demands from you. But it is a wonderful time.
Good so made some tea and got back to work.
Today I did some work on the UI. I guess one obstacle is my way of working.
I always work from point to point. I usually open my laptop, start a podcast and have no idea what is being worked on. I start XCode and the simulator and then I just try something until I get something I like.
And this way works amazingly well for me. Drawing and prototyping I tried everything, but this work bores me a lot and I prefer to work in the code of the app and see what is possible and feasible in the simulator. Now I have to load Test Flight and try it out again and again on my own mobile phone. Maybe open and test again and again for a few days, I’m not pressed for time.
So today I worked on the buttons for the media you can add to posts.
Here is the code:
struct MediaButton: View {
@State private var isEmpty : Bool = true
var icon : String
var amount : Int
var body: some View {
ZStack(alignment: .leading) {
Rectangle()
.cornerRadius(7, corners: [.topRight, .bottomRight])
.cornerRadius(50, corners: [.topLeft, .bottomLeft])
.foregroundColor(Color("water"))
.opacity(isEmpty ? 0 : 1)
HStack {
Button {
withAnimation(.spring()) {
isEmpty.toggle()
}
} label: {
Image(icon)
.resizable()
.scaledToFit()
.frame(width: 30, height: 30)
.frame(width: 40, height: 40)
.background(Color("midGray"))
.cornerRadius(50, corners: isEmpty ? [.bottomRight, .bottomLeft, .topLeft, .topRight] : [.topRight, .bottomRight])
.cornerRadius(isEmpty ? 50 : 7, corners: [.topLeft, .bottomLeft])
}
if !isEmpty {
Spacer()
Button {
withAnimation(.spring()) {
isEmpty.toggle()
}
} label: {
Text("\(amount)")
.font(Font.custom("Bitter-Bold", size: 16))
.foregroundColor(Color("lightCreme"))
}
Spacer()
}
}
}.frame(width: isEmpty ? 40 : 90, height: 40)
}
}
Maybe you can do something with the code, you can see the result here:
Well, enough for today. Stay fresh and nice…