Post

Replies

Boosts

Views

Activity

how to get real time camera frame in swiftui
I want to get real time camera frames to apply machine learning in swiftui. i made camera app with swiftui like this. but, i don't know how to get camera frame and how to apply machine learning techniques to camera frames struct ImagePicker: UIViewControllerRepresentable {       var sourceType: UIImagePickerController.SourceType = .camera       func makeUIViewController(context: UIViewControllerRepresentableContext) -> UIImagePickerController {           let imagePicker = UIImagePickerController()         imagePicker.allowsEditing = false         imagePicker.sourceType = sourceType           return imagePicker     }       func updateUIViewController(_ uiViewController: UIImagePickerController, context: UIViewControllerRepresentableContext) {       } }
0
0
959
Jun ’22
Can I participate in swift student challenge as a soldier?
I'm sorry I don't speak English well, so I use a translator so sentences may be awkward. I am a Korean college student who likes swift. Most Korean men go to the military. So next year I will take a leave of absence from university and I will be one of them. But, I would like to participate in the annual WWDC swift student challenge. Is it possible for me to participate and win? If I take a leave of absence and participate as a soldier, is it impossible to receive the award?
0
0
1k
Jun ’22
how to use back camera in AVCapture?
i use this code in my app // MARK: - Protocol protocol VideoManagerProtocol: AnyObject {   func didReceive(sampleBuffer: CMSampleBuffer) } final class VideoManager: NSObject {       // MARK: -- Properties       /// RequestPermissionCompletionHandler   typealias RequestPermissionCompletionHandler = ((_ accessGranted: Bool) -> Void)       /// delegate of VideoManager   weak var delegate: VideoManagerProtocol?       /// An object that manages capture activity.   let captureSession = AVCaptureSession()       /// A device that provides input (such as audio or video) for capture sessions. //  let videoDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .front) // choose deviceType, position is better but don't know ipad camera so choose default saftely   let videoDevice = AVCaptureDevice.default(for: .video)   /// A Core Animation layer that displays the video as it’s captured.   lazy var videoLayer: AVCaptureVideoPreviewLayer = {     return AVCaptureVideoPreviewLayer(session: captureSession)   }()       /// A capture output that records video and provides access to video frames for processing.   lazy var videoOutput: AVCaptureVideoDataOutput = {     let output = AVCaptureVideoDataOutput()     let queue = DispatchQueue(label: "VideoOutput", attributes: DispatchQueue.Attributes.concurrent, autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency.inherit)     output.setSampleBufferDelegate(self, queue: queue)     output.alwaysDiscardsLateVideoFrames = true     return output   }()       // MARK: -- Methods   override init() {     guard let videoDevice = videoDevice, let videoInput = try? AVCaptureDeviceInput(device: videoDevice) else {       fatalError("No `Video Device` detected!")     }           super.init()           captureSession.addInput(videoInput)     captureSession.addOutput(videoOutput)   }       func startVideoCapturing() {     self.captureSession.startRunning() // do not operate in dispatch global background //    DispatchQueue.global(qos: .background).async { //      self.captureSession.startRunning() //    }   }       func stopVideoCapturing() {     captureSession.stopRunning()   }       func requestPermission(completion: @escaping RequestPermissionCompletionHandler) {     AVCaptureDevice.requestAccess(for: .video) { (accessGranted) in       completion(accessGranted)     }   } } extension VideoManager {     } // MARK: - AVCaptureVideoDataOutputSampleBufferDelegate extension VideoManager: AVCaptureVideoDataOutputSampleBufferDelegate {       func captureOutput(_ output: AVCaptureOutput, didDrop sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {     delegate?.didReceive(sampleBuffer: sampleBuffer)   } } i tried like this AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) The camera uses only the front camera. how to use back camera?
0
0
1.7k
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
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
Can I write department office information in the supervisor's information when applying?
I am leave of absence. i don't know my dean, principal, superintendent information. so, can i write my department office information in supervisor's information when applying?
Replies
0
Boosts
0
Views
729
Activity
Apr ’22
where is submit button?
I finished my playground app, and I filled out my information on the submission page. Can't find submit button
Replies
0
Boosts
0
Views
602
Activity
Apr ’22
Any references to machine learning with swiftui?
i'm learning about swiftui and machine learning(by python pytorch). I want to use machine learning in swiftui like coreml or vision. but, almost reference of coreml or vision are written in uikit. so, any references(book or lecture or document, yotube) to machine learning with swiftui?
Replies
0
Boosts
0
Views
1.2k
Activity
Jun ’22
how to get real time camera frame in swiftui
I want to get real time camera frames to apply machine learning in swiftui. i made camera app with swiftui like this. but, i don't know how to get camera frame and how to apply machine learning techniques to camera frames struct ImagePicker: UIViewControllerRepresentable {       var sourceType: UIImagePickerController.SourceType = .camera       func makeUIViewController(context: UIViewControllerRepresentableContext) -> UIImagePickerController {           let imagePicker = UIImagePickerController()         imagePicker.allowsEditing = false         imagePicker.sourceType = sourceType           return imagePicker     }       func updateUIViewController(_ uiViewController: UIImagePickerController, context: UIViewControllerRepresentableContext) {       } }
Replies
0
Boosts
0
Views
959
Activity
Jun ’22
Can I participate in swift student challenge as a soldier?
I'm sorry I don't speak English well, so I use a translator so sentences may be awkward. I am a Korean college student who likes swift. Most Korean men go to the military. So next year I will take a leave of absence from university and I will be one of them. But, I would like to participate in the annual WWDC swift student challenge. Is it possible for me to participate and win? If I take a leave of absence and participate as a soldier, is it impossible to receive the award?
Replies
0
Boosts
0
Views
1k
Activity
Jun ’22
how to use back camera in AVCapture?
i use this code in my app // MARK: - Protocol protocol VideoManagerProtocol: AnyObject {   func didReceive(sampleBuffer: CMSampleBuffer) } final class VideoManager: NSObject {       // MARK: -- Properties       /// RequestPermissionCompletionHandler   typealias RequestPermissionCompletionHandler = ((_ accessGranted: Bool) -> Void)       /// delegate of VideoManager   weak var delegate: VideoManagerProtocol?       /// An object that manages capture activity.   let captureSession = AVCaptureSession()       /// A device that provides input (such as audio or video) for capture sessions. //  let videoDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .front) // choose deviceType, position is better but don't know ipad camera so choose default saftely   let videoDevice = AVCaptureDevice.default(for: .video)   /// A Core Animation layer that displays the video as it’s captured.   lazy var videoLayer: AVCaptureVideoPreviewLayer = {     return AVCaptureVideoPreviewLayer(session: captureSession)   }()       /// A capture output that records video and provides access to video frames for processing.   lazy var videoOutput: AVCaptureVideoDataOutput = {     let output = AVCaptureVideoDataOutput()     let queue = DispatchQueue(label: "VideoOutput", attributes: DispatchQueue.Attributes.concurrent, autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency.inherit)     output.setSampleBufferDelegate(self, queue: queue)     output.alwaysDiscardsLateVideoFrames = true     return output   }()       // MARK: -- Methods   override init() {     guard let videoDevice = videoDevice, let videoInput = try? AVCaptureDeviceInput(device: videoDevice) else {       fatalError("No `Video Device` detected!")     }           super.init()           captureSession.addInput(videoInput)     captureSession.addOutput(videoOutput)   }       func startVideoCapturing() {     self.captureSession.startRunning() // do not operate in dispatch global background //    DispatchQueue.global(qos: .background).async { //      self.captureSession.startRunning() //    }   }       func stopVideoCapturing() {     captureSession.stopRunning()   }       func requestPermission(completion: @escaping RequestPermissionCompletionHandler) {     AVCaptureDevice.requestAccess(for: .video) { (accessGranted) in       completion(accessGranted)     }   } } extension VideoManager {     } // MARK: - AVCaptureVideoDataOutputSampleBufferDelegate extension VideoManager: AVCaptureVideoDataOutputSampleBufferDelegate {       func captureOutput(_ output: AVCaptureOutput, didDrop sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {     delegate?.didReceive(sampleBuffer: sampleBuffer)   } } i tried like this AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) The camera uses only the front camera. how to use back camera?
Replies
0
Boosts
0
Views
1.7k
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
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
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
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