목록Swift (208)
HIT해
https://github.com/pointfreeco/swift-composable-architecture GitHub - pointfreeco/swift-composable-architecture: A library for building applications in a consistent and understandable way,A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind. - pointfreeco/swift-composable-architecturegithub.com TCA 를 활용한 Binding 처리는 두가지가 존재..
Xcode 업데이트를 한 뒤 해당 오류가 발생해서 앱을 자꾸 멈추게했다. 원인은 바로 @MainActor 가 포함된 코드를 메인 스레드에서 호출하지 않아서 발생하는 문제였다. 나의 경우 TCA run 코드가 백그라운드 스레드에서 실행되어서, 해당 코드를 메인 스레드로 전환해주어야했다. 해결 방법DispatchQueue.main.async를 사용해 메인 스레드에서 UI 상태를 변경하도록 수정해준다, let completionAction = SCNAction.run { node in // UI 업데이트는 메인 스레드에서 실행 DispatchQueue.main.async { self.parent.enable = true }} 이렇게 수정하면 self.parent.enable이 메인..

이미지 정중앙을 도려내고 싶다면 이 코드를 사용하는 것을 추천한다. func cropImageToCenterSquare(_ image: UIImage) -> UIImage? { let imageSize = image.size let shortLength = min(imageSize.width, imageSize.height) let origin = CGPoint( x: imageSize.width / 2, y: imageSize.height / 2 ) // 잘라낼 사각형 크기를 정사각형으로 설정 let square = CGRect(origin: origin, size: CGSize(width: shortLength/2, height:..

https://developer.apple.com/documentation/scenekit SceneKit | Apple Developer DocumentationCreate 3D games and add 3D content to apps using high-level scene descriptions, and easily add animations, physics simulation, particle effects, and realistic physically based rendering.developer.apple.com 돌의 3D 모습을 정면에서 딴 사진이 필요했다. 그리고 Render라는 메서드를 이용하면 화면을 캡쳐할 수 있다는 것을 알았다. func captureSceneImage(scene:..

https://developer.apple.com/watchos/planning/#create-an-interface-that-ofers-a-great-experience Planning your watchOS appLearn about the tools, technologies, and best practices for building apps for Apple Watch.developer.apple.com 이전에 기존 프로젝트에 워치 기능을 추가해 개발해보았다. 하지만 지원되지 않는 기능도 많고 실제 애플워치를 인식하지 못해서 디밸롭 해나갈 수 없었다. 지금은 Xcode 고질적인 문제때문애 안된다고 할지라도 조그마한 화면에서 기능들을 구현하는 욕심이 나기에 추후 개발하게 되었을때 익숙해질 수 있게 기..

밤새서 프로젝트 개발을 하고 잠들기전 심심풀이로 애플워치 앱을 개발해보았다. 기존에 진행하던 3D 애완돌 프로젝트를 워치에도 적용할 수 있나 궁금했다. 하지만 SwfitUI의 대부분 기능은 동작하지만 UIKit의 기능을 SwiftUI에 불러와서 사용할 수는 없었다. WatchOS에서는 UIResponsablity를 지원하지 않았다. 나는 기존 프로젝트에 워치앱을 추가해보았다. https://developer.apple.com/watchos/ watchOS - Apple DeveloperLearn about the latest major updates in watchOS that you can use to build great apps for Apple Watch.developer.apple.com 기존 ..

Swift의 유일한 오점 Xcode 이녀석은 git이랑 엮이면 정신을 못차린다 하하. 이번엔 git rebase를 하고 기존에 있던 파일이 사라졌다. 이런 경우 프로젝트에는 없지만 실제 폴더에 가면 소스코드파일이 있기에 드래그 앤 드랍을 해주면 된다. 그리고 실행을 하면 아마 대부분 Multiple commands produce '/Users/ 이런 오류가 발생할것이다. 이건 파일이 두번 참조되고 있어서 실행을 시키지 못하는 상황이다.(이런 상황이 발생할떄마다 Xcode는 최악의 IDE인 사실이란 것을 상기시킨다) Target > Build phase에서 중복으로 추가되어있는 항목을 삭제해줘야한다. 이렇게 수정을 거치면 우리의 두번째 말썽쟁이 pbxporj다. phase에서 참조를 수정하면 pbxpr..

https://github.com/pointfreeco/swift-composable-architecture/blob/main/Examples/Search/SearchTests/SearchTests.swift swift-composable-architecture/Examples/Search/SearchTests/SearchTests.swift at main · pointfreeco/swift-composable-architectureA library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind. - pointfreeco/swift-composa..