Post

Replies

Boosts

Views

Created

why is this error occurring?
my code func placeObjectAtImageTracking(object: ModelEntity, imageAnchor: ARImageAnchor) -> AnchorEntity {     let imageAnchorEntity = AnchorEntity(anchor: imageAnchor) return imageAnchorEntity } in this code, AnchorEntity(anchor: imageAnchor) is occuring error when i changed xcode setting device. It's fine when I set it to my real phone, but when I change it to the simulator, the following error appears. No exact matches in call to initializer  how to solve it?
3
0
1.8k
Jan ’23
How can I input some commands into terminal in Swift like this?
that is my python code (file name pythonTest.py) while True: a = input() print(a) I want to run this python code in a swift script and get the result. For example, I would like to enter something command like this. python3 pythonTest.py\n1\n2\n3\n and ctrl + C i found Process() but this is only entered once and I don't know how to handle input(), ctrl + C How can I do that? If it's not possible in Swift, is it possible in Python?
0
0
1.1k
Mar ’23
When to use private?
I watched Stanford 193p, and I had a question. When the professor writes the code, he writes like this struct GameView: View { var body: some View { gameBody } var gameBody: some View { Button("gameBody") { gameBodyFunc() } } private func gameBodyFunc() { } } Why is the function declared private but not the gameBody variable? I am impressed with his coding style and want to learn it.
2
0
787
Mar ’23
AnimatableModifier and Animatable, ViewModifier
This code works fine. struct Cardify: AnimatableModifier { init(isFaceUp: Bool) { rotation = isFaceUp ? 0 : 180 } var animatableData: Double { get { rotation } set { rotation = newValue } } var rotation: Double func body(content: Content) -> some View { ZStack { let shape = RoundedRectangle(cornerRadius: DrawingConstants.cornerRadius) if rotation < 90 { shape.fill().foregroundColor(.white) shape.strokeBorder(lineWidth: DrawingConstants.lineWidth) } else { shape.fill() } content .opacity(rotation < 90 ? 1 : 0) } .rotation3DEffect(Angle.degrees(rotation), axis: (0, 1, 0)) } private struct DrawingConstants { static let cornerRadius: CGFloat = 10 static let lineWidth: CGFloat = 3 } } But the code below where I changed AnimatableModifier to Animatable, ViewModifier doesn't work. struct Cardify: Animatable, ViewModifier { init(isFaceUp: Bool) { rotation = isFaceUp ? 0 : 180 } var animatableData: Double { get { rotation } set { rotation = newValue } } var rotation: Double func body(content: Content) -> some View { ZStack { let shape = RoundedRectangle(cornerRadius: DrawingConstants.cornerRadius) if rotation < 90 { shape.fill().foregroundColor(.white) shape.strokeBorder(lineWidth: DrawingConstants.lineWidth) } else { shape.fill() } content .opacity(rotation < 90 ? 1 : 0) } .rotation3DEffect(Angle.degrees(rotation), axis: (0, 1, 0)) } private struct DrawingConstants { static let cornerRadius: CGFloat = 10 static let lineWidth: CGFloat = 3 } } how do i fix it?
0
0
681
Jul ’23
Which coding style is more popular among the two?
I prefer the coding style below. (Of course, the code below is not long, but when the number of lines is long) struct ContentView: View { var body: some View { VStack { text hello } } var text: some View { Text("text") .padding() } var hello: some View { Button("hello") { print("hello") } } } But people seem to prefer the style below.(Not only when the number of lines of code is small, but also when it is long) struct ContentView: View { var body: some View { VStack { Text("text") .padding() Button("hello") { print("hello") } } } } Which coding style is more popular among the two?
2
0
738
Aug ’23
Can i use emoji in my iOS App?
I want to use emoji like this in my iOS app and release it on the App Store. struct ContentView: View { @State private var move = false var body: some View { VStack { Text("👻") .font(.largeTitle) .position(x: move ? 50 : 400) Button("Move") { withAnimation(.linear(duration: 2)) { move.toggle() } } } } } Are there any other problems with this?(like legal issues, etc.)
1
0
2.5k
Aug ’23
Can I use the machine learning model provided here in my app?
I'm trying to create an app that uses artificial intelligence technology. One of the models provided on this website(https://developer.apple.com/machine-learning/models/) will be used. Are there any copyright or legal issues if I create an app using the model provided by this website and distribute it to the App Store?
1
0
852
May ’24
why is this error occurring?
my code func placeObjectAtImageTracking(object: ModelEntity, imageAnchor: ARImageAnchor) -> AnchorEntity {     let imageAnchorEntity = AnchorEntity(anchor: imageAnchor) return imageAnchorEntity } in this code, AnchorEntity(anchor: imageAnchor) is occuring error when i changed xcode setting device. It's fine when I set it to my real phone, but when I change it to the simulator, the following error appears. No exact matches in call to initializer  how to solve it?
Replies
3
Boosts
0
Views
1.8k
Activity
Jan ’23
How can I input some commands into terminal in Swift like this?
that is my python code (file name pythonTest.py) while True: a = input() print(a) I want to run this python code in a swift script and get the result. For example, I would like to enter something command like this. python3 pythonTest.py\n1\n2\n3\n and ctrl + C i found Process() but this is only entered once and I don't know how to handle input(), ctrl + C How can I do that? If it's not possible in Swift, is it possible in Python?
Replies
0
Boosts
0
Views
1.1k
Activity
Mar ’23
When to use private?
I watched Stanford 193p, and I had a question. When the professor writes the code, he writes like this struct GameView: View { var body: some View { gameBody } var gameBody: some View { Button("gameBody") { gameBodyFunc() } } private func gameBodyFunc() { } } Why is the function declared private but not the gameBody variable? I am impressed with his coding style and want to learn it.
Replies
2
Boosts
0
Views
787
Activity
Mar ’23
Is this possible without a backend server?
The process of the app I'm trying to make is simply like this. It calls the weather API every morning at 7:00 and gives a notification if it rains. Do I need to create a new backend server or is it possible to schedule on iOS?
Replies
0
Boosts
0
Views
884
Activity
Mar ’23
how to load rcproject in swiftpm project?
I am a student preparing for the wwdc swift student challenge. I am trying to build an AR app, but rcproject is not loading in swiftpm. What should I do? My code is below. private var game = try! game.loadGame() help me..
Replies
0
Boosts
1
Views
993
Activity
Mar ’23
I won the Swift Student challenge this time. I have a question.
As far as I know, the winning result confirmation webpage disappears after a few years. I want to use the fact that I won when I get a job in a few years, but how can I prove it?
Replies
1
Boosts
0
Views
1.3k
Activity
May ’23
Will the supervisor be contacted after I win the challenge?
I won the challenge. Will supervisors be contacted further after I win? (Requirements such as student identification) If so, I would like to consult with the supervisor.
Replies
0
Boosts
0
Views
1k
Activity
May ’23
AnimatableModifier and Animatable, ViewModifier
This code works fine. struct Cardify: AnimatableModifier { init(isFaceUp: Bool) { rotation = isFaceUp ? 0 : 180 } var animatableData: Double { get { rotation } set { rotation = newValue } } var rotation: Double func body(content: Content) -> some View { ZStack { let shape = RoundedRectangle(cornerRadius: DrawingConstants.cornerRadius) if rotation < 90 { shape.fill().foregroundColor(.white) shape.strokeBorder(lineWidth: DrawingConstants.lineWidth) } else { shape.fill() } content .opacity(rotation < 90 ? 1 : 0) } .rotation3DEffect(Angle.degrees(rotation), axis: (0, 1, 0)) } private struct DrawingConstants { static let cornerRadius: CGFloat = 10 static let lineWidth: CGFloat = 3 } } But the code below where I changed AnimatableModifier to Animatable, ViewModifier doesn't work. struct Cardify: Animatable, ViewModifier { init(isFaceUp: Bool) { rotation = isFaceUp ? 0 : 180 } var animatableData: Double { get { rotation } set { rotation = newValue } } var rotation: Double func body(content: Content) -> some View { ZStack { let shape = RoundedRectangle(cornerRadius: DrawingConstants.cornerRadius) if rotation < 90 { shape.fill().foregroundColor(.white) shape.strokeBorder(lineWidth: DrawingConstants.lineWidth) } else { shape.fill() } content .opacity(rotation < 90 ? 1 : 0) } .rotation3DEffect(Angle.degrees(rotation), axis: (0, 1, 0)) } private struct DrawingConstants { static let cornerRadius: CGFloat = 10 static let lineWidth: CGFloat = 3 } } how do i fix it?
Replies
0
Boosts
0
Views
681
Activity
Jul ’23
Which coding style is more popular among the two?
I prefer the coding style below. (Of course, the code below is not long, but when the number of lines is long) struct ContentView: View { var body: some View { VStack { text hello } } var text: some View { Text("text") .padding() } var hello: some View { Button("hello") { print("hello") } } } But people seem to prefer the style below.(Not only when the number of lines of code is small, but also when it is long) struct ContentView: View { var body: some View { VStack { Text("text") .padding() Button("hello") { print("hello") } } } } Which coding style is more popular among the two?
Replies
2
Boosts
0
Views
738
Activity
Aug ’23
Can i use emoji in my iOS App?
I want to use emoji like this in my iOS app and release it on the App Store. struct ContentView: View { @State private var move = false var body: some View { VStack { Text("👻") .font(.largeTitle) .position(x: move ? 50 : 400) Button("Move") { withAnimation(.linear(duration: 2)) { move.toggle() } } } } } Are there any other problems with this?(like legal issues, etc.)
Replies
1
Boosts
0
Views
2.5k
Activity
Aug ’23
Can I use the machine learning model provided here in my app?
I'm trying to create an app that uses artificial intelligence technology. One of the models provided on this website(https://developer.apple.com/machine-learning/models/) will be used. Are there any copyright or legal issues if I create an app using the model provided by this website and distribute it to the App Store?
Replies
0
Boosts
0
Views
677
Activity
May ’24
Can I use the machine learning model provided here in my app?
I'm trying to create an app that uses artificial intelligence technology. One of the models provided on this website(https://developer.apple.com/machine-learning/models/) will be used. Are there any copyright or legal issues if I create an app using the model provided by this website and distribute it to the App Store?
Replies
1
Boosts
0
Views
852
Activity
May ’24