Productivity
iPad Multitasking: 새 윈도우에서 열기 기능 추가
// 이 액션을 메뉴에 넣으면 된다.
let newSceneAction = UIWindowScene.ActivationAction({ _ in
// 새로운 Scene을 나타내기 위한 User Activity 생성
let userActivity = NSUserActivity(activityType: "com.myapp.detailScene")
// activation configuration 반환
return UIWindowScene.ActivationConfiguration(userActivity: userActivity)
})
Keyboard Navigation
Keyboard shortcuts
class AppDelegate: UIResponder, UIApplicationDelegate {
override func buildMenu(with builder: UIMenuBuilder) {
// 빌더를 통해서 메뉴를 변경하면 된다.
}
}
iPad pointer
iPhone에서도 앱 간 드래그앤 드롭 기능 지원
UI refinements
UIToolbar와 UITabbar 디자인 변경 - 배경이 없는 것처럼 처리됨
Tabbar는 SF Symbol 지원 추가
다음 코드는 비쥬얼 이슈가 있을 수 있음
// 불투명 처리
bar.isTranslucent = false
// 표준적이지 않은 테두리 처리
viewController.edgesForExtendedLayout = .top
기본 동작이 마음에 들지 않는다면, Appearance 객체를 할당하라.
let appearance = UITabBarAppearance()
appearance.backgroundEffect = nil
appearance.backgroundColor = .blue
tabBar.scrollEdgeAppearance = appearance // UINavigationBar에만 있던게 ToolBar와 TabBar에도 생김
let scrollView = ... //
viewController.setContentScrollView(scrollView, for: .bottom)
API environments
var config = UIButton.Configuration.tinted()
config.title = "Add to Cart"
config.image = UIImage(systemName: "cart.badge.plus")
config.imagePlacement = .trailing
config.buttonSize = .large
config.cornerStyle = .capsule
self.addToCartButton = UIButton(configuration: config)
SubMenu
SF Symbol 스타일 추가 - 심볼도 configuration 이 생김
SF Symbol을 선언적으로 사용 가능 → 첫 시작만 문자열로 하면, 나머지는 modifier로
Content Size Category 제한
extension UIView {
var minimumContentSizeCategory: UIContentSizeCategory
var maximumContentSizeCategory: UIContentSizeCategory
}
SystemColor 추가
ColorPicker 강화(iOS 14.5)
TextKit2
상태 복원 API → UIScene도 지원한다.
Scene 레벨에서의 공유 → 이건 잘 모르겠다.
Cell configuration 클로저
let cell: UICollectionViewCell = ...
cell.configurationUpdateHandler = { cell, state in
var content = UIListContentConfiguration.cell().updated(for: state)
if state.isDisabled {
content.textProperties.color = .systemGray
}
cell.conetntConfiguration = content
}
Performance
// 비동기 로딩
if let image = UIImage(contentsOfFile: pathToImage) {
async {
let preparedImage = await image.byPreparingForDisplay()
imageView.image = preparedImage
}
}
// 썸네일화
if let bigImage = UIImage(contentsOfFile: pathToBigImage) {
async {
let preparedImage = await bigImage.byPreparingThumbnail(ofSize: smallSize)
imageView.image = preparedImage
}
}
Security and privacy