일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- iOS16
- mac
- Notification
- geofencing
- UIButton
- window
- Git
- JPA
- view
- Apple
- github
- darkmode
- Firebase
- MacOS
- FLUTTER
- Xcode
- IOS
- Session
- 한글
- Swift
- appstore
- Archive
- 웹뷰
- Code
- Realm
- 개발자
- 이미지
- rxswift
- error
- SwiftUI
- Today
- Total
목록Swift (182)
EEYatHo 앱 깎는 이야기
아이폰용 프레임워크 Users/[사용자 이름]/Library/Developer/Xcode/DerivedData/[프로젝트 이름 + 이상한 문자들]/Build/Products/Debug-iphoneos 시뮬레이션용 프레임워크 Users/[사용자 이름]/Library/Developer/Xcode/DerivedData/[프로젝트 이름 + 이상한 문자들]/Build/Products/Debug-iphoneosDebug-iphonesimulator 에다가 넣어놓고 해야함 Xcode에서 프레임워크 찾는 환경변수가 저기라 별도의 설정을 안한 이상 저기에 꼭 넣어야함
UIApplication.shared.keyWindow -끗- 저기에다가 addSubView, safeAreaLayoutGuide 등 다 가능!
corner이나 shadow는 한번만 해줘도 되고, 중요한건 layoutSubviews /// 제목 길이에 따라 셀 크기가 다르므로 처리해줘야 할 것들 override func layoutSubviews() { super.layoutSubviews() // 그림자 제대로 다시 그리기 + 그림자 그리는 성능 향상 layer.shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: 12).cgPath // 제약 업데이트 updateConstraints() } good
드래그 애니메이션이 끝난 후 위치가 맨 밑일 경우 실행되는 함수. func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { if (scrollView.contentOffset.y + 1) >= (scrollView.contentSize.height - scrollView.frame.size.height) { // 하고싶은 코드 } } 애니메이션이 끝나고 자시고 그냥 감지하고싶으면 scrollViewDidScroll 에 써도됩니다.
scrollViewDidEndScrollingAnimation: 프로그래밍 방식으로 생성 된 스크롤이 완료되면 호출됩니다. scrollViewDidEndDecelerating: 사용자 스와이프 스크롤이 완료되면 호출됩니다. 정답 : scrollViewDidEndDecelerating 얘를 썼어야 했다..!
정규식과 NSRegularExpression.matches 를 이용하면 된다. 한글, 영어, 숫자, 밑줄만 허용하는 정규식 : "^[가-힣ㄱ-ㅎㅏ-ㅣa-zA-Z0-9_]$" 입력받은 문자열이 정규식에 만족하지는 체크하는 함수 알맞은 문자열 : return true 부적합한 문자열 : return false private func nameValidation(text: String) -> Bool { // String -> Array let arr = Array(text) // 정규식 pattern. 한글, 영어, 숫자, 밑줄(_)만 있어야함 let pattern = "^[가-힣ㄱ-ㅎㅏ-ㅣa-zA-Z0-9_]$" if let regex = try? NSRegularExpression(pattern: patt..
일일히 버튼 만들고 선택 상태에서 UI 바꾸고.. 그러다가 UISwitch 란걸 알게되었다. 넘무 좋아 누르면 알아서 상태바뀌고, 상태 저장도 해주고, 애니메이션까지?! 세상에 네상에 UISwitch 선언 private lazy var pushSwitch: UISwitch = { let mySwitch = UISwitch() mySwitch.onTintColor = Resource.Color.bgYellow02 mySwitch.thumbTintColor = Resource.Color.orange06 mySwitch.addTarget(self, action: #selector(onClickSwitch(sender:)), for: .valueChanged) return mySwitch }() + 스위치 선택..
UISearchBar 선언부 lazy var searchBar: UISearchBar = { let searchbar = UISearchBar() let placeholderText = "검색어를 입력해 주세요." searchbar.placeholder = placeholderText if let textField = searchbar.value(forKey: "searchField") as? UITextField { textField.backgroundColor = .white if let font = UIFont(name: Resource.Font.NanumSquareRoundR.rawValue, size: 16) { let placeholderAttributedText = NSAttributedSt..