View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Port your Mac app to Apple silicon

    Your porting questions, answered: Learn how to recompile your macOS app for Apple silicon Macs and build universal apps that launch faster, have better performance, and support the future of the platform. We'll show you how Xcode makes it simple to build a universal macOS binary and go through running, debugging, and testing your app. Learn what changes to low-level code you might need to make, find out how to handle in-process and out-of-process plug-ins, and discover some useful tips for working with universal apps.

    We've designed this session for experienced macOS developers who want to get their existing apps running natively on Apple silicon Macs. You can learn more about doing so in the Apple silicon documentation.

    For more information on the transition to Apple silicon, watch "Explore the new system architecture of Apple silicon Macs", "Bring your Metal app to Apple silicon Macs", and "Optimize Metal Performance for Apple silicon Macs". And to learn how to run your iPhone and iPad apps on Mac, check out "iPad and iPhone apps on Apple silicon Macs".

    Recursos

    • Learn more about Apple Silicon
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC20

    • Bring your Metal app to Apple silicon Macs
    • Explore the new system architecture of Apple silicon Macs
    • iPad and iPhone apps on Apple silicon Macs
    • Optimize Metal Performance for Apple silicon Macs

    WWDC19

    • All About Notarization

    WWDC18

    • Understanding Crashes and Crash Logs
  • Buscar neste vídeo...
    • 21:19 - Don’t assume the time is returned in nanoseconds

      // Don’t assume the time is returned in nanoseconds
      
      func monotonicTimestampInSeconds() -> Double {
        let ticks = mach_absolute_time()
        let seconds = Double(ticks) / 1_000_000_000
        return seconds
      }
    • 21:40 - Use clock_gettime_nsec_np to read timestamp in nanoseconds

      // Use clock_gettime_nsec_np to read timestamp in nanoseconds
      
      func monotonicTimestampInSeconds() -> Double {
        let nanoseconds = clock_gettime_nsec_np(CLOCK_UPTIME_RAW)
        let seconds = Double(nanoseconds) / 1_000_000_000
        return seconds
      }
    • 26:40 - Avoid spinlocks and spinning to check for work

      func performWorkUnderSpinlock() { 
        spinlock_lock()
        performWork()
        spinlock_unlock()
      }
      
      func retrieveNextWorkTask() -> WorkTask {
        while true {
          let task = queue.sync { taskQueue.pop() }
          if let task = task { return task }
          else { continue }
        }
      }
    • 27:03 - Prefer blocking locks and condition variables

      func performWorkUnderSpinlock() { 
        os_unfair_lock_lock()
        performWork()
        os_unfair_lock_unlock()
      }
      
      func retrieveNextWorkTask() -> WorkTask {
        condition.lock()
        while !taskQueue.hasAnyWork {
          condition.wait()
        }
        let task = taskQueue.pop()
        condition.unlock()
        return task
      }
    • 33:51 - Load a plug-in dynamically

      void *plugin_module = dlopen("./path/to/plugin.dylib", RTLD_NOW);
      if (plugin_module == NULL) {
        fprintf(stderr, "loading module failed:\n");
        fprintf(stderr, "%s\n", dlerror());
        return 0;
      }

Developer Footer

  • Vídeos
  • WWDC20
  • Port your Mac app to Apple silicon
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • 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
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines