Macos App Bridging Header

MacOS & Mac Apps I've restored them to some extent but cannot figure out how to prevent VO from announcing headings on certain web pages. I enjoy reading Google News, and every heading and level is announced as I navigate with QuickNav from one topic to another.

  1. Macos App Bridging Header Creator
  2. Macos App Bridging Header Footer

Swift is an exciting new programming language combining the best of older languages such as Java, C++, Objective-C, JavaScript etc. However, huge code bases exist that are written in C and C++. What if you have a library developed in C++ and want to leverage that code in you Swift applications? Here we will see how to incorporate a simple C++ library into a trivial Swift command line utility on Mac OS X. We are going to

Macos app bridging header creatorHere it's assumed that you know the basics of using Xcode, Mac OS X Terminal command line, and programming in Swift, C, and C++.

Create a Swift Command Line Utility in Xcode

First we are going to create a simple command line utility in Swift using Xcode. We could have created a more sophisticated GUI app, but since the focus here is on interfacing Swift with C++ code, a command line utility will suffice.
  1. In Xcode go to File->New->Project, in the dialog that appears select Command Line Tool and click Next.
  2. Choose a name for your project and type it in the Product Name field in the next dialog; make sure Swift is selected in the Language field. For the purposes of this tutorial let's call it cli_swift. Click Next.
  3. In the dialog that appears select a location for your project and click Create. The resulting project should consist of one Swift source file, main.swift, which contains:import Foundationprintln('Hello, World!')We can comment out or remove the 'import Foundation' line, since we are not using any of the Foundation features.
  4. Now we can run our project by clicking the Run button from the toolbar, selecting Run from the Product menu, or by typing Command-R. We see 'Hello, World!' printed out in the output pane.

Create a C++ Library Using GCC

Now let's build a simple C++ static library. We could have done it in Xcode, but let's just use a command line compiler, GCC. The command for compiling/linking C++ code is g++. You can also use the Clang compiler that should come with your Mac OS X, in which case replace g++ with clang++ in the example.
  1. Choose a location for the library and cd to that directory.
  2. Create the header file for the library, let's call it junk.h, with the following content:class A{public: A(int); int getInt();private: int m_Int;};
  3. Create the library's implementation file, call it junk.cpp, with the following content:#include 'junk.h'A::A(int _i) : m_Int(_i) {}int A::getInt() { return m_Int; }
  4. Compile junk.cpp to object file, junk.o, and create a library, named libjunkcpp.a, that contains the object file ($ is the command prompt of the Terminal):$ g++ -c junk.cpp$ ar r libjunkcpp.a junk.o

Add C++ Wrapper to the Xcode Project to Provide the Swift-C++ Interface

Now that we have our library, let's go back to Xcode and create a C++ file providing the 'glue' between our C++ library and command line utility written in Swift. The 'glue' has to be in C++ because it will call C++ library code that was not written to be called from C. The 'glue' is, however, written in such a way that it can be called from C code, and things that can be called from C can typically be also called from Swift. See the comments in the code below.
  1. Add the static C++ library to the Xcode project. We need this in order to be able to call the library from the C++ wrapper ('glue'). Please see here how to do this.
  2. Add the library's header file, junk.h, to our project by going to File->Add Files to 'cli_swift'..., navigating to the file, and clicking Add.
  3. Go to File->New->File, select C++ file in the dialog that appears, and click Next.
  4. Type wrapper.cpp in the Name field, uncheck 'Also create a header file,' and click Next.
  5. In the dialog that appears choose a location for the new file and click Create.
  6. If at this point Xcode suggests that you create a bridging header, click Yes. Otherwise we can create a bridging header manually by going to the 'Swift Compiler - Code Generation' section under Build Settings and specifying a header name on the 'Objective-C bridging Header' line.
  7. Modify wrapper.cpp to have the following content:#include 'junk.h'// extern 'C' will cause the C++ compiler // (remember, this is still C++ code!) to // compile the function in such a way that// it can be called from C // (and Swift). extern 'C' int getIntFromCPP() { // Create an instance of A, defined in // the library, and call getInt() on it: return A(1234).getInt();}

Use C++ from Swift Code via the Wrapper

Now we need to tell Swift about the getIntFromCPP() method. Any C functions that we want to call from Swift must be declared in the bridging header, so we add the following to the bridging header:int getIntFromCPP();Now we can call the method from Swift by adding the following to main.swift:println('The integer from C++ is (getIntFromCPP())')Run the project, and the output is:AppHello, World!The integer from C++ is 1234That's it! Congratulations! You have just written a Swift app that uses an external static library written in C++. Below is a screenshot of what your Xcode project might look like:

Every Mac is built with assistive technologies to support people who are blind or have low vision. The VoiceOver screen reader describes exactly what’s happening on your screen. Hover Text lets you instantly magnify a selection of text. And Display Accommodations support color blindness and other vision needs.

Hover TextGet a quick size boost of what you’re reading.

Hover Text makes it easier to view text on your display. If a paragraph, caption, or headline is too small to read, just hover over it with your cursor and press Command. You’ll get a dedicated window with a large, high-resolution version of your selection. You can even choose the fonts and colors that work best for you.

VoiceOverHear what’s happening on your screen.

VoiceOver does more than tell you what’s happening on your Mac. It helps you make things happen. It gives you auditory descriptions of each onscreen element and provides helpful hints along the way — whether you prefer using gestures, a keyboard, or a braille display. And it supports more than 35 languages, including multiple voice options.

VoiceOverIntegrated throughout macOS and every built-in app.

VoiceOver is unique because it’s not a standalone screen reader. It’s deeply integrated in macOS and all the built-in apps on Mac. And as developers update their apps to take advantage of the accessibility interfaces provided by Apple, their apps can start working with VoiceOver right away.

VoiceOverImproved PDF, web, and messages navigation.

We’ve refined VoiceOver to make it easier to navigate PDFs, websites, and messages. In Safari, improved conformance with HTML5 accessibility standards allows for more consistent navigation of websites. VoiceOver is now better at reading aloud tagged PDFs and email messages. If you start reading a website in a different language, VoiceOver can switch to the voice for that language automatically.¹ And you can add custom commands and workflows to your MacBook Pro with Touch Bar.

Header

Audio DescriptionsHear the details in every scene.

Watch movies with detailed audio descriptions of every scene on your Mac. Movies with audio descriptions are displayed with the AD icon in the iTunes Store.

VoiceOverNavigate VoiceOver with simple gestures.

You can control VoiceOver using many of the same gestures you use with iOS. Touch the trackpad to hear a description of the item under your finger, drag to hear items continuously, and flick to move to the next item. Enable the VoiceOver Trackpad Commander, and the trackpad surface will represent the current window or document, so you can navigate quickly to any corner or edge with a tap.

VoiceOverA virtual controller with customizable commands.

VoiceOver features a virtual control called the rotor. Turning the rotor — by rotating two fingers on the trackpad as if you were turning an actual dial — lets you access an array of fully customizable commands. Use it to browse web pages more efficiently and intuitively. The rotor lists common elements like “headings,” “links,” and “images,” and lets you navigate directly to the element of your choosing.

VoiceOverPlug-and-play support for braille displays.

VoiceOver is the first screen reader to provide plug-and-play support for refreshable braille displays. Plug in or sync one of over 100 compatible displays, supporting more than 80 international tables, and the VoiceOver description is presented to you in braille. You can edit seamlessly in Grade 2 Braille, viewing your edits in the context of the actual line of text. Optimized for fast braille typists, VoiceOver makes working in braille easy and efficient. Converting between braille and text happens automatically so you see only Grade 2 Braille. And for sighted users who sit alongside you, there’s an onscreen braille panel that displays both braille and plain-text versions of the descriptions spoken by VoiceOver.

Dark ModeWorking hard gets easier on the eyes.

Dark Mode transforms the desktop and built-in apps with a dark color scheme that helps you focus on your work.2 The fine points of your content take center screen as toolbars and menus recede into the background. Light text against darker backdrops in Mail, Safari Reader, Calendar, and more makes everything easier to read in low lighting conditions. And the Accessibility preferences for increased contrast and reduced transparency work with Dark Mode enabled.

DictationYou say it. Mac types it.

Dictation lets you talk where you would type — and it works in over 40 languages. So you can reply to an email, search the web, or write a report using just your voice. Navigate to any text field, activate Dictation, then say what you want to write. macOS also comes with more than 50 editing and formatting commands. So you can turn on Dictation and tell your Mac to bold a paragraph, delete a sentence, or replace a word. You can also use Automator workflows to create your own Dictation commands.

SiriStreamline the things you do every day.

Siri helps you do more with your desktop.³ Ask Siri to send messages, track down files, create reminders, search the web, and even turn on and off VoiceOver and Invert Colors, without interrupting what you’re doing on the keyboard. And because Siri is integrated with VoiceOver, you can ask it to find a file and hear the answer read out loud. If you prefer to communicate by typing, you can easily set Siri to “Type to Siri” mode.

ZoomMake your screen up to 20 times bigger.

Zoom is a powerful built-in magnifier that lets you enlarge your screen up to 20 times, so you can better see what’s on the display. You can zoom using full screen or picture-in-picture, allowing you to see the zoomed area in a separate window while keeping the rest of the screen at its native size. A shortcut key lets you pan the screen without moving the pointer while zoomed in. macOS can also flash the screen for notifications offscreen or speak text under your pointer. The hardware acceleration engine lets you boost the size of anything on your screen — text on a web page, family photos, or a place on a map.

Zoom DisplaySee content up close and at a distance simultaneously.

Now with macOS Catalina, if you have two displays, you can keep one zoomed in close while the other stays at a standard resolution. So you can tackle everyday work or give a presentation more efficiently.

Cursor SizeMagnify your cursor so it’s easier to use.

macOS lets you magnify your cursor so it’s easier to see where you are and follow along as you move around your Mac. Set the cursor size once and it stays magnified even when its shape changes. And when you swipe back and forth on your trackpad or quickly shake your mouse, the pointer grows so it’s easier to locate.

Contrast and Color OptionsInvert colors or enable color filters.

macOS lets you invert colors, enable grayscale, or choose from a range of color filters to support different forms of color blindness or other color vision deficiencies. You can select a common preset or fine-tune the color tint and hue to customize a display setting that works for you.

Reduce MotionDecrease the movement of onscreen elements.

If you’re affected by the motion of screen elements, you can turn on Reduce Motion to decrease movement in areas like Spaces, Notification Center, and the Dock.

Music, Podcasts, Books and TVNavigate and play with VoiceOver.

The Apple Music, Apple Podcasts, Apple Books, and Apple TV apps are compatible with VoiceOver, so you can navigate and play all your content even if you can’t see the screen. Browse the apps as VoiceOver reads out headers, links, and other elements on the page.

Resources

Support

User Guides

Download Unified English Braille version of macOS VoiceOver User Guide
Or order an embossed copy of macOS VoiceOver User Guide

External Resources

Hadley Institute for the Blind and Visually Impaired

Explore instructional videos with tips on using vision accessibility features in macOS.

Learn more about the Hadley Institute instructional videos at their website

Join a community of blind and low-vision users of Apple products.

Learn more about AppleVis.com at their website

Macos App Bridging Header Creator

Get information on the use of Apple products by those who are blind or low vision.

Learn more about Mac-cessibility Network at their website