적당한 고통은 희열이다

- 댄 브라운 '다빈치 코드' 중에서

반응형

Swift iOS 앱 개발 164

[Swift iOS] UILabel Gradient color (+ SwiftUI gradient text)

UILabel 에 그라데이션 색상 입히기 GPT 는 소용이 없어연,, ㅎ 알려준대로 해도 그라데이션 전혀 안먹히더라 final class GradientLabel: UILabel { private var colors: [UIColor] = [.red, .yellow] private var startPoint: CGPoint = CGPoint(x: 0.0, y: 0.5) private var endPoint: CGPoint = CGPoint(x: 1.0, y: 0.5) private var gradientLayer = CAGradientLayer() override init(frame: CGRect) { super.init(frame: frame) setup() } required init?(coder: ..

[Swift] UIImage grayscale 이미지 흑백 변환

UIImage 를 흑백으로 변환하는 법 extension UIImage { func convertToGrayScale() -> UIImage { let context = CIContext(options: nil) if let currentFilter = CIFilter(name: "CIPhotoEffectTonal") { let input = CIImage(image: self) currentFilter.setValue(input, forKey: kCIInputImageKey) if let output = currentFilter.outputImage, let cgImage = context.createCGImage(output, from: output.extent) { return UIImage(cgI..

[Swift] UISwipeGestureRecognizer 를 이용한 스와이프 액션을 파헤쳐보자 !

스와이프 제스처에 대해 알아보자! Handling swipe gestures Detect a horizontal or vertical swipe motion on the screen, and use it to trigger navigation through your content. A swipe gesture occurs when a person moves one or more fingers across the screen in a specific horizontal or vertical direction. Use the UISwipeGestureRecognizer class to detect swipe gestures. UISwipeGestureRecognizer 이용해 스와이프 제스처를 감지할 수 있..

[iOS] 긴급 심사 요청

안드로이드는 빠른데 애플은 심사가 굉장히 느리다,, 기본 하루는 잡아야하눈데 치명적인 버그를 발견했을때(?) 급하게 다시 배포를 해야할 때가 있다. 오전 열시 반쯤에 긴급 심사 요청 했도니 오후 두세시 쯤 바로 심사 완료가 되었다! 짱 빠른걸 ㅎㅎ 하지만 너무 남용하면 안해준다고 하니.. 진짜 필요할때만 잘 써먹어보자. Developer 사이트 하단에 Contact Us / 문의하기 버튼을 누른다. If your submission is rejected during this review, you don’t need to request another expedited review when you resubmit. Your resubmission will be automatically returned to ..

[Swift iOS] 화면 스와이프 swipe to pop / swipe back (+ RxGesture)

uinavigationController 를 사용하면 화면 왼쪽 끝부분에서 스와이프 할 때 popViewController 처럼 이전 화면으로 넘어갈 수 있지만, 화면 중앙이나 다른 부분에서는 스와이프를 해도 뒤로 넘어갈 수 없다. 화면 어디서나 swipe back 을 할 수 있도록 만드는 방법을 알아보았다. 카카오나 인스타그램의 경우 커스텀으로 swipe back 기능을 구현해주었는지, 화면 어디서나 스와이프를 하면 손 위치를 따라 뷰가 같이 움직이며 따라오지만 그것까지는 아니고, 그냥 어디서든 스와이프 하면 이전 화면으로 넘어갈 수 있도록만 구현하였다. 이거는 UISwipeGestureRecognizer 를 이용해서 간단하게 구현이 가능하다. 1. UISwipeGestureRecognizer var ..

[Swift iOS] Lottie Animation 적용하기 (+ multiple animation)

import UIKit import Lottie class ViewController: UIViewController { var animationView: AnimationView? override func viewDidLoad() { super.viewDidLoad() animationView = .init(name: "coffee") animationView?.frame = view.bounds animationView?.loopMode = .loop animationView?.animationSpeed = 0.5 //1이 기본 속도, 클수록 빨라짐 view.addSubview(animationView) animationView?.play() //view.sendSubviewToBack(animati..

enum case 예외 처리 (default 값 설정)

최근 후기 뜨지 않는 문제. enum 디코딩 에러. enum case 예외 처리 개발 서버에서 테스트 중에 최근 후기가 뜨지 않는 문제가 발생했다. ERROR : dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "reviews", intValue: nil), _JSONKey(stringValue: "Index 7", intValue: 7), CodingKeys(stringValue: "product_type", intValue: nil)], debugDescription: "Cannot initialize SaleProductType from invalid Int value 15", underlyingError:..

[Swift iOS] Color setting

* asset에 컬러 추가. 활용하기 enum Colors 에 static let 으로 선언? 아니면 기존 방식대로? xcode 에서 swift로 UIColor 적용할 때, asset에 colorset 추가 후에 enum Colors 안에 static let 으로 컬러들을 선언해서 사용하는 게 좋을까, 아니면 UIColor 에 extension으로 UIColor를 반환하는 함수를 만들어서 안에 switch case로 컬러를 선언해주는 게 더 좋을까? 1. enum Colors 안에 static let 으로 컬러들을 선언해서 사용 2. UIColor에 extension으로 UIColor를 반환하는 함수를 만들어서 switch case로 컬러를 가져와서 사용. 1번의 장점 : 컬러를 타입 안전하게 사용할 수..

728x90
반응형