UXUI 디자인을 공부하는 학생입니다.
오늘은 Apple의 Human Interface Guidelines(HIG)에서 가장 기본이 되는 네 가지 영역을 스터디 준비를 위해 정리해보았습니다.
"7명 중 1명은 디지털 기기를 사용하는 데 어려움을 겪고 있어요. 접근성은 모든 사용자를 위한 기본 중의 기본입니다."
// 버튼에 음성 설명 추가하기
button.accessibilityLabel = "프로필 사진 업로드"
button.accessibilityHint = "갤러리에서 사진을 선택할 수 있어요"
// 복잡한 화면 요소도 쉽게 이해할 수 있게
customView.isAccessibilityElement = true
customView.accessibilityLabel = "프로필 정보"
customView.accessibilityTraits = .header
// 버튼을 충분히 크게 만들기
extension UIButton {
func setMinimumTouchArea() {
let minSize = CGSize(width: 44, height: 44) // 최소 44x44 크기
let buttonSize = bounds.size
let widthPadding = max(minSize.width - buttonSize.width, 0)
let heightPadding = max(minSize.height - buttonSize.height, 0)
hitTestInsets = UIEdgeInsets(
top: -heightPadding/2,
left: -widthPadding/2,
bottom: -heightPadding/2,
right: -widthPadding/2
)
}
}
// 사용자가 설정한 글자 크기에 맞추기
class CustomLabel: UILabel {
override init(frame: CGRect) {
super.init(frame: frame)
setupDynamicText()
}
private func setupDynamicText() {
adjustsFontForContentSizeCategory = true
font = UIFont.preferredFont(forTextStyle: .body)
}
}
"첫인상이 중요하듯이, 앱 아이콘은 우리 앱의 얼굴입니다."
✅ 이렇게 하면 좋아요:
❌ 이렇게 하면 안돼요:
struct AppIconSizes {
// iOS/iPadOS용 크기
static let appStore = "1024x1024 픽셀"
static let iPhone = "180x180 픽셀 (@3x)"
static let iPad = "167x167 픽셀 (@2x)"
// macOS용 크기
struct MacOS {
static let appStore = "1024x1024 픽셀"
static let dock = "128x128 픽셀"
static let finder = "32x32 픽셀"
}
// Apple Watch용 크기
struct WatchOS {
static let appStore = "1024x1024 픽셀"
static let home = "80x80 픽셀 (@2x)"
}
}
// 앱 아이콘 변경 기능 구현
class IconChanger {
static func changeIcon(to iconName: String?) {
guard UIApplication.shared.supportsAlternateIcons else {
print("이 기기는 아이콘 변경을 지원하지 않아요 😢")
return
}
UIApplication.shared.setAlternateIcon(iconName) { error in
if let error = error {
print("아이콘 변경 실패: \(error.localizedDescription)")
} else {
print("아이콘이 성공적으로 변경되었어요! 🎉")
}
}
}
}
"우리 앱의 특별한 개성을 보여주되, Apple의 플랫폼 특성도 잘 지켜야 해요!"
// 브랜드 색상 정의하기
extension UIColor {
static let brandMain = UIColor(named: "BrandMain")
static let brandSub = UIColor(named: "BrandSub")
// 다크모드에서도 잘 보이게
static let brandBackground = UIColor { mode in
switch mode.userInterfaceStyle {
case .dark:
return UIColor(named: "BrandBackgroundDark")!
default:
return UIColor(named: "BrandBackgroundLight")!
}
}
}
// 브랜드 폰트 설정
extension UIFont {
static func brandFont(size: CGFloat) -> UIFont {
// 브랜드 폰트가 없다면 시스템 폰트 사용
return UIFont(name: "BrandFont-Regular", size: size) ??
.systemFont(ofSize: size)
}
}
""색상은 단순한 꾸미기가 아닌, 의미를 전달하는 중요한 수단이에요!"
class CustomView: UIView {
func setupColors() {
// 기본 배경색
backgroundColor = .systemBackground
// 강조색
tintColor = .systemBlue
// 구분선 색상
layer.borderColor = UIColor.separator.cgColor
}
}
// 색상 대비 체크 함수
func isColorContrastGood(text: UIColor, background: UIColor) -> Bool {
let ratio = calculateContrastRatio(text, background)
// WCAG 2.0 기준
let minimumRatio: CGFloat = 4.5
return ratio >= minimumRatio
}
// 다크모드용 색상 정의
extension UIColor {
static let customBackground = UIColor { mode in
switch mode.userInterfaceStyle {
case .dark:
return .systemGray6
default:
return .white
}
}
static let customText = UIColor { mode in
switch mode.userInterfaceStyle {
case .dark:
return .white
default:
return .black
}
}
}