[swift] Swift Presentr의 기능

Swift Presentr는 iOS 앱에서 사용자에게 다양한 형태의 모달 팝업 창을 제공하는 라이브러리입니다. 이 라이브러리는 UIKit의 UIViewController를 사용하여 커스텀된 모달 창을 생성하고 관리할 수 있는 기능을 제공합니다.

주요 기능

1. 커스텀 모달 창 생성

Swift Presentr를 사용하면 다양한 디자인의 커스텀 모달 창을 생성할 수 있습니다. 다음은 간단한 예제 코드입니다.

import Presentr

let presenter = Presentr(presentationType: .popup)
let customViewController = CustomViewController(nibName: "CustomViewController", bundle: nil)

customViewController.title = "Custom Modal"
customViewController.modalPresentationCapturesStatusBarAppearance = true

presenter.presentationAnimation = .fadeIn
presenter.dismissalAnimation = .fadeOut

presenter.transitionType = .coverVertical
presenter.dismissTransitionType = .coverVertical

presenter.roundCorners = false
presenter.cornerRadius = 10

presenter.backgroundColor = UIColor.black.withAlphaComponent(0.5)

customViewController.customPresentViewController(presenter, animated: true, completion: nil)

위의 예제 코드에서는 Presentr 객체를 생성하고, 해당 객체의 속성을 설정하여 모달 창의 외부적인 효과 및 애니메이션을 커스터마이즈합니다. 그리고 customPresentViewController 메서드를 사용하여 모달 창을 표시합니다.

2. 다양한 모달 팝업 스타일

Swift Presentr는 다양한 모달 팝업 스타일을 지원합니다. 주요한 스타일은 다음과 같습니다.

이외에도 .bottomHalf, .fullScreen, .custom 등의 스타일이 제공되며, 필요에 따라 알맞게 선택하여 사용할 수 있습니다.

3. 애니메이션 및 효과 설정

Swift Presentr는 모달 창의 애니메이션 및 효과를 설정할 수 있습니다. 다양한 애니메이션과 효과 중에서 원하는 스타일을 선택할 수 있습니다.

예를 들어, presentationAnimation 속성과 dismissalAnimation 속성을 사용하여 모달 창이 나타나고 사라질 때의 애니메이션 스타일을 설정할 수 있습니다.

결론

Swift Presentr은 iOS 앱에서 커스텀된 모달 팝업 창을 간편하게 구현할 수 있게 도와주는 유용한 라이브러리입니다. 다양한 기능과 다양한 스타일을 제공하므로, 앱에 맞는 모달 팝업 창을 손쉽게 구현할 수 있습니다.

GitHub - Swift Presentr