Posts

Post marked as solved
4 Replies
0 Views
Replied In Xcode issue
Alright! Thanks a lot!!
Post marked as solved
4 Replies
0 Views
Replied In Xcode issue
I'm using macOS Ventura and on App Store is written Xcode 13.4.1, which I can't open.
Post not yet marked as solved
3 Replies
0 Views
I've seen it but it doesn't seem the answer of my question, maybe I explained my self not clearly. I want to create a button with the neumorphic animation.
Post marked as solved
5 Replies
0 Views
@Claude31 I have one more little question. If I would like to add more circle than 3, where should I edit the code?
Post marked as solved
5 Replies
0 Views
@Claude31, it's right. But I want it without the animation, so display different circles in different positions but without the animation.
Post not yet marked as solved
2 Replies
0 Views
OK. I tried this: import SwiftUI public struct Block: View {     public var body: some View {         Rectangle()             .frame(width: 90, height: 90)     } } and in the ContentView: But now it gives me one other error. import PlaygroundSupport import SwiftUI struct ContentView: View {     var body: some View {         Block() // ERROR: 'Block' initializer is inaccessible due to 'internal' protection level.     } } PlaygroundPage.current.setLiveView(ContentView())
Post marked as solved
5 Replies
0 Views
Sorry, I didn't express myself well... I need to change the text style and apply a font on it (like: Palatino, Gill Sans, Futura, SF Pro etc...). Is it possible?
Post marked as solved
5 Replies
0 Views
@SpiderKenny actually I want to change the style of the text.
Post not yet marked as solved
3 Replies
0 Views
Yeah, actually she's working in my school. So maybe it's OK.
Post not yet marked as solved
2 Replies
0 Views
Here's the code: import PlaygroundSupport import SwiftUI struct ContentView:  View {     @State private var isDragging = false     @State private var dragOffset: CGSize = .zero     @State var position: CGSize = .zero     @State private var hovered = false     var body: some View {         RoundedRectangle(cornerRadius: 20)             .foregroundColor(.red)             .frame(width: 100, height: 100)             .position(x: 400, y: 350)         RoundedRectangle(cornerRadius: 20)             .foregroundColor(.blue)             .frame(width: 100, height: 100)             .position(x: 400, y: 350)             .animation(.default, value: hovered)             .offset(x: dragOffset.width + position.width, y: dragOffset.height + position.height)             .gesture(                 DragGesture()                     .onChanged({ value in                         self.dragOffset = value.translation                     })                     .onEnded({ value in                         self.position.width += value.translation.width                         self.position.height += value.translation.height                         self.dragOffset = .zero                     })             )     } } PlaygroundPage.current.setLiveView(ContentView()) I want the blue square to attach with the red square when I drag near it.
Post not yet marked as solved
2 Replies
0 Views
I tried it but it shows me only the number and I wanted the badge icon, so a circle with a number on it. I tried this but the circle is very big how can I set the dimension of the circle so that it looks like a badge? struct ContentView: View {      func increment() {         count = count + 1     }     @State var showBadge = false     @State var count = 0     var body: some View {         Button(action: {             showBadge.toggle() // badge(9)             if showBadge { increment() }         }, label: {             Text("show badge")         })         if showBadge {             Rectangle()                 .frame(width: 180, height: 200)                 .foregroundColor(.blue)                 .position(x: 70, y: 70)                 .badge(count)                 .overlay(                     Circle(), alignment: .topLeading)         } else {             Rectangle()                 .frame(width: 180, height: 200)                 .foregroundColor(.blue)         }} }
Post not yet marked as solved
1 Replies
0 Views
Here's my code: I want to show the badge on the badge on the rectangle each time I press on it. But currently it isn't working what I did wrong? import SwiftUI import PlaygroundSupport struct ContentView: View {     var body: some View {         Button(action: {             badge(9)          }, label: {             Rectangle()                 .frame(width: 180, height: 200)                 .foregroundColor(.blue)         })     } } PlaygroundPage.current.setLiveView(ContentView())
Post not yet marked as solved
2 Replies
0 Views
Okay, but the problem is where to locate them. I did something like this, but it gives errors. import SwiftUI import PlaygroundSupport struct ContentView: View {     var cards = [1, 2, 3, 4, 5, 6]     var body: some View {         cards.shuffle()         print(cards)     } } PlaygroundPage.current.setLiveView(ContentView())
Post not yet marked as solved
1 Replies
0 Views
Replied In Learn to code
Hi! When I started learn coding with Swift Playgrounds, I remember some levels were not easy to me, in fact I stayed on them many days. If you want to learn how code in Swift Playgrounds I recommend you the books about coding in Swift, you can find them in "Everyone Can Code" series on Apple Books and they're free. But they'll help you to get started and learn code not to pass levels. I hope it helped you.