예제 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 import SwiftUI struct ContentView: View { @State private var isShowAlert = false @State private var selectText = "x" var body: some View { VStack{ Button("show alert") { isShowAlert.toggle() } .alert(isPresented: $isShowAlert, content: { let primaryButton = Alert.Button.d..
예제 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 import SwiftUI struct ContentView: View { var body: some View { VStack{ Text("Main Title!") .font(.largeTitle) .foregroundColor(.black) .bold() .padding(.bottom, 20) // 일반 스타일 Text("Sub Title!") .modifier(textSty..
예제 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 import SwiftUI struct Animal: Identifiable{ let id = UUID() let name: String let index: Int } struct ContentView: View { var animalList = [ Animal(name: "dog", index: 3), Animal(name: "dog", index: 1), Animal(name: "do..
Life Cycle정리 아이폰 OS에서 어플리케이션의 상태는 위와 같이 정리된다. Not Running : 말 그대로 어플리케이션이 작동 중이지 않은 상태로 메모리에도 올라가 있지 않다. Foreground : 앱이 메모리 상에 존재하고 화면을 점유하고 있는 상태. -active : 앱이 유저의 화면을 대부분 점유하여 모든 기능이 완전히 제어 가능한 상태. -inactive : 앱이 외부요인(문자, 카톡, 전화 등)으로 인해 일부 기능의 제어권을 잃은 상태. 길지 않음. Background : 앱이 메모리 상에 존재하고 화면을 점유하고 있지 않은 상태. -suspend : 앱이 'Background'에서 아무 동작도 하고 있지 않는 상태. // 메모리가 부족하거나 너무 오랜 시간 아무 작업도 하지 않게 ..
view.isUserInteractionEnabled 기본값은 true이며 false로 설정 시 해당 뷰부터 하위에 있는 stucture들의 iteraction이 차단된다. (활용) collectionview에서 cell의 contentview 하위에 supplementaryview로 설정한 view가 존재할 시, 위 방법을 적용하면 유저가 터치 시 해당 cell내부의 view들의 간섭이 차단된다. 즉, collectionview에 있어 유저의 활동 영역이 cell의 선택, 해제 두개로 간단화된다.
dequeueReusableCell withReuseIdentifier 로 collectionview를 구성하게되면 화면에서 벗어난 cell을 reuse하는 경우가 생긴다. 앱 개발에 있어 이것이 문제를 일으킨 경우로는 func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) 를 사용해 cell선택시 해당 cell이 선택됐음을 표시하는 기능을 구현하던 중, a번 셀을 선택했는데 화면밖에 있어 표시되지 않던 b번 셀이 같이 선택 되는 오류가 있었다. (imageview의 'checkmark.circle.fill' 과 'circle' 을 toggle하여 선택됨을 표시하는 방식이었다.) 이를 해결하기..
extension UIView { func setBorderShadow(borderWidth : CGFloat,cornerRadius : CGFloat,borderColor : CGColor = UIColor.systemGray.cgColor, useShadowEffect boolean : Bool){ //테두리 설정 self.layer.borderWidth = borderWidth self.layer.cornerRadius = cornerRadius self.layer.borderColor = borderColor //테두리 그림자 효과 설정 self.layer.masksToBounds = !boolean self.layer.shadowColor = UIColor.systemGray.cgColor //..
public extension UIView { private static let kLayerNameGradientBorder = "GradientBorderLayer" func setGradientBorder( width: CGFloat, colors: [UIColor], startPoint: CGPoint = CGPoint(x: 0.5, y: 0), endPoint: CGPoint = CGPoint(x: 0.5, y: 1) ) { let existedBorder = gradientBorderLayer() let border = existedBorder ?? CAGradientLayer() border.frame = bounds border.colors = colors.map { return $0.cgC..
- Total
- Today
- Yesterday
- 전처리기
- clean code
- XcodeBuildSystem
- Swift
- 링커
- clean code 정리
- BFS
- 주입
- SwiftUI
- 면접질문
- 알고리즘
- ios
- ios simulator
- XCFramework
- 클린 코드
- 단어변환
- dfs
- 프로그래머스
- 클린 코드 줄거리
- 여행경로
- 의존성
- swiftc
- 메모리 순환참조
- CLANG
- 생명 주기
- 이분탐색
- 의존관계역전법칙
- 순환참조
- 클린 코드 정리
- 학교 과제
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |