Swift
-
-
[SwiftUI] iOS의 거리단위 Point 에 대해서Swift/SwiftUI 2022. 4. 12. 00:22
Point는 무엇이며 Pixel과 무엇이 다른가 Mobile design 101: pixels, points and resolutions The difference between pixels, points and resolutions can be confusing even for experienced designers. blog.fluidui.com Sketch의 단위는 Point이다 Does Sketch measure text layers in points or pixels? Sketch uses the macOS coordinates system, which is measured in points. So, when you work in Sketch, everything is measured in p..
-
[SwiftUI] TextEditor에 Placeholder를 만들어주자Swift/SwiftUI 2022. 4. 7. 08:23
원래 TextEditor는 Placeholder 기능이 자체적으로 지원되지 않는다 하지만 만들어 주자 이런식으로 만들꺼다 text: $description 은 @State 변수로 유저의 입력을 받아서 담아줄꺼임 Zstack으로 Editor 위에 Text를 쌓을껀데 이게 바로 우리의 placeholder가 될것임 description 이 비어 있다면 즉 유저가 아무것도 입력하지 않았다면 Text를 그려서 위에 올려 버리자
-
[SwiftUI] Button 을 Toggle 처럼 사용해보자Swift/SwiftUI 2022. 4. 5. 23:22
구현해볼 Helper는 title: Turtle Rock 옆에 있는 별 모양이다 기능적으로는 Favorite place를 mark하는 기능이다 버튼을 누르면 true : star.fill 이라고 작동한다 우리가 인스타그램에서 좋아요 누르는거랑 똑같다 근데 이건 true or false를 반환하는 toggle이 아니다 button이다 하지만 toggle처럼 작동한다 어떻게 된걸까? Detail View 의 code 이다 FavoriteButton이라고 따로 만든 View로 전달 되고 있으며 보여주고자하는 data의 isFavorite값을 parameter로 전달하고있다 그러면 FavoriteButton View를 살펴보자 Button이지만 isSet이라는 Bool type 변수를 만들어서 .toggle()..