목록Swift (208)
HIT해

Range란?범위를 나타내는 함수다! 사용예시let myRange = 0...2 // 0 , 1, 2let mySecondRange = 0.. 배열에 적용하는 방법이다let myFriends = ["짱구". "철수", "유리", "멩구"]let tempRange = 0.. 범위에 대한 기본적인 문법이기에 헷갈리지 않고 잘 익혀서 사용하자

이전 포스팅을 참고하면 도움이 될 것 같다!https://100percent-me.tistory.com/entry/Swift-%EA%B8%B0%EC%B4%88%EB%AC%B8%EB%B2%95-30-class-func-vs-static-func [Swift 기초문법 - 30] class func vs static func사용예시class Friend{ // 1. func sayHi(){ print("안녕!") } // 2. class func sayBye(){ print("바이바이") } // 3. static func sayHoho(){ print("호호") }}// 1.// 호출하려면 인스턴스를 만들어야한다// 클래스를 메모리에 올려100percent-me.tistory.com class MyClas..

디자인 툴에서 obj dae 로 내보냈을때 텍스쳐 하나하나 설정을 해주어야 하기에 fbx 파일로 SceneKit에 출력하기로 했다. 하지만 SceneKit 에서는 fbx 파일이 scn 으로 변환되지 않는다.( 왜...? 다 해준다며... ) 그래서 fbx > usdz > scn 으로 바꿔줘야한다. 1. fbx to usdzfbx 파일을 Reality Converter 로 열어준다. 우측 상단의 내보내기를 눌러서 저장하면 usdz 파일로 변환이 된다..! 2. usdz to scn아주 간단하다.Xcode > File > New > File > Scene Catalog 로 카탈로그를 만들어주면 SceneKit Scene Tool 이 나오는데여기에 드래그 앤 드랍을 해준다. 3. 파일 출력하기let scene..

사용자가 3D 모델의 색을 바꿀 수 있는 기능이 있으면 어떨까 생각이들어 색을 변경하는 기능을 만들어보았다. 모델에 접근하려면 NodeName을 알아야 접근할 수 있다. ModelNodeName 출력하기func printNodeDetails(node: SCNNode, depth: Int = 0) { // 현재 노드의 이름과 깊이를 출력합니다. let indentation = String(repeating: " ", count: depth) print("\(indentation)Node name: \(node.name ?? "Unnamed")") // 노드의 지오메트리가 있으면 지오메트리의 정보를 출력합니다. if let geometry = node.geometry { ..

https://developer.apple.com/documentation/scenekit/scnview SCNView | Apple Developer DocumentationA view for displaying 3D SceneKit content.developer.apple.com SCNView란?3D SceneKit 콘텐츠를 표시하기 위한 뷰. 자료형// iOS, iPad, Mac Catalyst,class SCNView : UIView// macOSclass SCNView : NSView 개요macOS에서는 SCNView가 NSView의 서브클래스입니다. iOS와 tvOS에서는 SCNView가 UIView의 서브클래스입니다. 각 운영 체제의 뷰 계층 구조의 일부로서, SCNView 객체는 앱의 사..

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 모델링 파일을 화면에 구현하는 작업을 맡았다. ARKit, RealityKit, SceneKit 를 활용해 3D 모델을 출력할 수 있는데 이중 SceneKit가 실제 카메라 ..

Zip이란?두가지 컬렉션을 합쳐 쌍으로 묶어준다! 사용예시let friends = ["짱구" , "철수" , "유리"]let pets = ["흰둥이", "사람", "토끼"]let friendAndPetPairs = zip(friends, pets)friendAndPetPairsfor aPair in friendAndPetPairs { print("\(aPair.0), \(aPair.1)")} 튜플로 묶여있기에 아래와 같이 결과가 나온다 배열 크기가 맞지 않는다면??import Foundationlet friends = ["짱구" , "철수" , "유리", "훈이"]let pets = ["흰둥이", "사람", "토끼"]let friendAndPetPairs = zip(friends, pets)friend..

JSON 통신이나 AF TCA 에서 자주 사용되는 Equatable이 무엇일까.항상 사용하라고만해서 사용했지 무슨 의미로 사용되는지 몰랐었다. Equtable이란Swfit 표준 라이브러리에 정의된 프로토콜로 타입이 동등성 검사를 지원하기 위해 채택하는 프로토콜이다.즉 두 인스턴스가 같은지 아닌지를 비교할 수 있게 해준다.이 프로토콜을 채택한 타입은 == 연산자를 구현해야 하며 이는 두 인스턴스가 동일한지 확인하는 데 사용된다. Equatable의 기본 개념protocol Equatable { static func ==(lhs: Self, rhs: Self) -> Bool} 자동으로 != 연산자도 제공된다. Equtable 프로토콜 구현struct Person: Equatable { let na..