View in English

  • Apple Developer
    • 시작하기

    시작하기 탐색

    • 개요
    • 알아보기
    • Apple Developer Program

    알림 받기

    • 최신 뉴스
    • Hello Developer
    • 플랫폼

    플랫폼 탐색

    • Apple 플랫폼
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    피처링

    • 디자인
    • 배포
    • 게임
    • 액세서리
    • 웹
    • 홈
    • CarPlay
    • 기술

    기술 탐색

    • 개요
    • Xcode
    • Swift
    • SwiftUI

    피처링

    • 손쉬운 사용
    • AI 및 머신러닝
    • 앱 인텐트
    • Apple Intelligence
    • 게임
    • 보안
    • Xcode Cloud
    • 커뮤니티

    커뮤니티 탐색

    • 개요
    • Apple과의 만남 이벤트
    • 커뮤니티 이벤트
    • 개발자 포럼
    • 오픈 소스

    피처링

    • WWDC
    • Swift Student Challenge
    • 개발자 이야기
    • App Store 어워드
    • Apple 디자인 어워드
    • 문서

    문서 탐색

    • 문서 라이브러리
    • 기술 개요
    • 샘플 코드
    • 휴먼 인터페이스 가이드라인
    • 비디오

    릴리즈 노트

    • 피처링 업데이트
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • 다운로드

    다운로드 탐색

    • 모든 다운로드
    • 운영 체제
    • 애플리케이션
    • 디자인 리소스

    피처링

    • Xcode
    • TestFlight
    • 서체
    • SF Symbols
    • Icon Composer
    • 지원

    지원 탐색

    • 개요
    • 도움말
    • 개발자 포럼
    • 피드백 지원
    • 문의하기

    피처링

    • 계정 도움말
    • 앱 심사 지침
    • 앱 심사 도움말
    • App Store Connect 도움말
    • 새로 추가될 요구 사항
    • 계약 및 지침
    • 시스템 상태
  • 빠른 링크

    • 이벤트
    • 뉴스
    • 포럼
    • 샘플 코드
    • 비디오
 

비디오

메뉴 열기 메뉴 닫기
  • 컬렉션
  • 전체 비디오
  • 소개

더 많은 비디오

  • 소개
  • 코드
  • Mac 앱에 터치 기능 도입하기

    Mac 앱에 터치 기능을 추가하는 방법을 알아보세요. 기존 마우스 트래킹 API에서 최신 제스처 인식기 및 터치에 최적화된 기본 컨트롤로 전환하는 방법을 살펴봅니다. 터치 대상을 최적화하고, Multi-Touch 동작을 구현하며, 시스템 제스처를 관리하여 놀라운 터치 경험을 제공하는 방법을 확인해 보세요. 본 세션을 최대한 활용하려면 'Mac을 위한 터치 디자인'을 시청하세요.

    챕터

    • 0:00 - Introduction
    • 0:30 - Touch across frameworks
    • 1:37 - Use control events
    • 3:05 - Adopt gesture recognizers
    • 5:14 - Expand hit targets
    • 6:24 - Customize touch scrolling
    • 6:57 - Manage gesture exclusivity
    • 8:17 - Disable system gestures
    • 9:39 - Additional touch tips
    • 11:56 - Next steps

    리소스

      • HD 비디오
      • SD 비디오

    관련 비디오

    Tech Talks

    • Mac을 위한 터치 디자인
  • 비디오 검색…
    • 2:08 - Custom button that overrides mouseDown

      // Custom button to detect start and end of tracking
      class IgnitionButton: NSButton {
          var delegate: IgnitionButtonDelegate?
      
          override func mouseDown(with event: NSEvent) {
              delegate?.buttonDidStartTracking()
              super.mouseDown(with: event)
              delegate?.buttonDidEndTracking()
          }
      }
    • 2:24 - Use NSControl events to detect tracking

      // Use NSControl events to detect start and end of tracking
      ignitionButton.addTarget(
          self,
          action: #selector(buttonDidStartTracking),
          for: [.trackingBegan, .trackingEntered]
      )
      
      ignitionButton.addTarget(
          self,
          action: #selector(buttonDidEndTracking),
          for: [.trackingExited, .trackingEndedInside]
      )
      
      ignitionButton.addTarget(
          self,
          action: #selector(buttonCancelledTracking),
          for: .trackingCancelled
      )
    • 3:13 - Mouse tracking loop

      let eventMask: NSEvent.EventTypeMask = [.leftMouseDragged, .leftMouseUp]
      while true {
          let nextEvent = NSApp.nextEvent(
              matching: eventMask,
              until: .distantFuture,
              inMode: .eventTracking,
              dequeue: true)
          if let nextEvent, nextEvent.type == .leftMouseUp {
              break
          }
      }
    • 4:11 - Refactored tracking functions

      // Refactored tracking functions
      func startTracking(at viewLocation: NSPoint) { /* ... */ }
      
      func continueTracking(at viewLocation: NSPoint) { /* ... */ }
      
      func endTracking(at viewLocation: NSPoint) { /* ... */ }
      
      func cancelTracking() { /* ... */ }
    • 4:24 - Add a touch-only pan gesture recognizer

      // Add touch-only pan gesture recognizer
      let touchRecognizer = NSPanGestureRecognizer(
          target: self,
          action: #selector(touchPan)
      )
      
      touchRecognizer.buttonMask = 0x0
      touchRecognizer.allowedTouchTypes = .direct
      
      wiringPanelView.addGestureRecognizer(touchRecognizer)
    • 4:52 - Pan gesture recognizer action

      // Pan gesture recognizer action function
      @objc func touchPan(_ recognizer: NSPanGestureRecognizer) {
          switch recognizer.state {
          case .began:
              startTracking(at: recognizer.location(in: wiringPanelView))
          case .changed:
              continueTracking(at: recognizer.location(in: wiringPanelView))
          case .ended:
              endTracking(at: recognizer.location(in: wiringPanelView))
          case .cancelled:
              cancelTracking()
          default:
              break
          }
      }
    • 5:37 - Expand hit targets for touch

      // Refactored tracking functions with expanded hit targets
      func startTracking(at viewLocation: NSPoint, expandHitRect: Bool = false) {
          for node in nodes {
              if point(viewLocation, in: node.frame, expandForTouch: expandHitRect) {
                  trackingNode = node
                  trackingLocation = viewLocation
                  return
              }
          }
      }
      
      func point(_ point: NSPoint, in rect: NSRect, expandForTouch: Bool = false) -> Bool {
          if expandForTouch {
              // Expand to minimum size of 36 points on each axis
          } else {
              // Nothing to do for mouse
          }
          return NSPointInRect(point, rect)
      }
      
      @objc func touchPan(_ recognizer: NSPanGestureRecognizer) {
          switch recognizer.state {
          case .began:
              startTracking(at: recognizer.location(in: wiringPanelView), expandHitRect: true)
          // ...
          default:
              break
          }
      }
    • 6:40 - Require two touches for scrolling

      // Modify touch scrolling properties
      decoratingView.enclosingScrollView?.minimumNumberOfTouchesForScrolling = 2
    • 7:48 - Allow simultaneous slider interaction

      // Simultaneous sliders
      stoveControlsView.exclusiveGestureBehavior = .notExclusive
    • 8:25 - Disable system gestures

      // Disabling system gestures
      stoveControlsView.window?.disablesDirectTouchSystemGestures = true
      
      // Mac Catalyst API
      extension UIViewController {
          var prefersDirectTouchSystemGesturesDisabled: Bool { get }
      }
      
      // SwiftUI API
      View.directTouchSystemGesturesDisabled()
    • 11:47 - Declare touch-native support in Info.plist

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <dict>
          <!-- ... -->
          <key>NSIsTouchNative</key>
          <true/>
          <!-- ... -->
      </dict>
      </plist>

Developer 바닥글

  • 비디오
  • Tech Talks
  • Mac 앱에 터치 기능 도입하기
  • 메뉴 열기 메뉴 닫기
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    메뉴 열기 메뉴 닫기
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    메뉴 열기 메뉴 닫기
    • 손쉬운 사용
    • 액세서리
    • AI 및 머신 러닝
    • Apple Intelligence
    • 오디오 및 비디오
    • 증강 현실
    • 비즈니스
    • 디자인
    • 배포
    • 교육
    • 게임
    • 건강 및 피트니스
    • Apple 앱 내 구입
    • 현지화
    • 지도 및 위치
    • 보안
    • Safari 및 웹
    메뉴 열기 메뉴 닫기
    • 문서
    • 다운로드
    • 샘플 코드
    • 비디오
    • 문서 아카이브
    메뉴 열기 메뉴 닫기
    • 도움말 및 문서
    • 문의하기
    • 포럼
    • 피드백 및 버그 리포트
    • 시스템 상태
    메뉴 열기 메뉴 닫기
    • Apple Developer
    • App Store Connect
    • 인증서, ID 및 프로파일
    • 피드백 지원
    메뉴 열기 메뉴 닫기
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    메뉴 열기 메뉴 닫기
    • Apple과의 만남
    • Apple Developer Centers
    • App Store 어워드
    • Apple 디자인 어워드
    • Apple Developer Academy
    • WWDC
    최신 뉴스 읽기 Apple Developer 앱 받기 bilibili, LinkedIn, WeChat, YouTube에서 팔로우하기
    Copyright © 2026 Apple Inc. 모든 권리 보유.
    약관 개인정보 처리방침 계약 및 지침