There are plenty of books, videos, and online resources for developing iOS apps. Despite the fact that iPhone and iPad apps require a Mac for code development, there is very little information about actually creating native Mac applications. The examples in this repository and the accompanying articles demonstrate various aspects of Mac app development using the latest versions of Swift and SwiftUI.
Links to articles that explain each code example are provided below. Code files are located in the scripts, xcode-projects, and xcode-playgrounds directories. Some articles do not have code files in this repository.
- Arrays,
scripts/arrays.swift
- Comments
- Compiler optimizations
- Create a package
- Date formatting,
scripts/dateformatted.swift
- Defaults command line tool
- Dictionaries
- Directory contents
- Discardable result
- Elapsed time,
scripts/elapsedtime.swift
- Element-wise array addition,
xcode-projects/ArrayAddition/
- Flat indexing an N-dimensional array,
scripts/flat-indexing.swift
- Image from array data,
xcode-playgrounds/ImageFromData/
- Image from colormap filter,
xcode-playgrounds/ImageColormap/
- Install Xcode
- Normalize array values,
xcode-playgrounds/NormalizeArray/
- Package a library
- Range
- Read Eval Print Loop (REPL)
- Resources
- Strides
- Strings
- Terminal setup and commands
- AppStorage,
xcode-projects/AppStorageProperty/
- Async for-in loop,
xcode-projects/AsyncForLoop/
- Blur effect,
xcode-projects/BlurEffect/
- Button styles,
xcode-projects/ButtonStyles/
- Credits,
xcode-projects/Credits/
- Cursors,
xcode-projects/Cursor/
- Display scale,
xcode-projects/DisplayScale/
- Grid lines,
xcode-projects/GridLines/
- Heat map chart,
xcode-projects/HeatMap/
- Image from colormap filter,
xcode-projects/ImageColormap/
- Images and symbols,
xcode-projects/Image/
,xcode-projects/ImageSFSymbols/
,xcode-projects/ImageSystem/
- Label,
xcode-projects/LabelText/
- LabeledContent,
xcode-projects/LabeledContentExample
- Line chart,
xcode-projects/LineChart/
- Menu items,
xcode-projects/MenuItems/
- NSPasteboard,
xcode-projects/NSPasteboard/
- Open a window,
xcode-projects/WindowOpen/
- Path markers,
xcode-projects/PathMarkers/
- Picker control,
xcode-projects/PickerControl
- Preferences window,
xcode-projects/PreferencesWindow/
- ProgressView,
xcode-projects/ProgressView/
,xcode-projects/ProgressViewBackground/
- ScrollView,
xcode-projects/ScrollView/
- Sidebar DisclosureGroup,
xcode-projects/SidebarDisclosureGroup/
- Sidebar toggle,
xcode-projects/SidebarToggle/
- Sine wave,
xcode-projects/SineWave/
- Stepper,
xcode-projects/Stepper/
- Table,
xcode-projects/TableBasic/
,xcode-projects/TableSelection/
,xcode-projects/TableSort/
- Text,
xcode-projects/Text/
,xcode-projects/TextFont/
,xcode-projects/TextStyles/
,xcode-projects/TextVertical/
- TextField,
xcode-projects/TextField/
- Thee column NavigationView,
xcode-projects/ThreeColumnNav
- Toggle animation,
xcode-projects/ToggleAnimation/
- Toolbar dropdown,
xcode-projects/ToolbarDropdown/
- Two column NavigationSplitView,
xcode-projects/TwoColNavSplit/
,xcode-projects/TwoColNavSplitFill/
- Two column NavigationView,
xcode-projects/TwoColumnNav/
,xcode-projects/TwoColumnNav2/
- View Tap Gesture,
xcode-projects/ViewTapGesture/
- ViewBuilder,
xcode-projects/ViewBuilder/
- WebView,
xcode-projects/WebViewLoadHtml/
,xcode-projects/WebViewLoadString/
,xcode-projects/WebViewLoadUrl/
- Window and toolbar style,
xcode-projects/WindowStyle/
- Window default size,
xcode-projects/WindowDefaultSize/
- Window resizability,
xcode-projects/WindowResizability/
- Absolute value
- Complex multiplication
- Matrix multiplication,
scripts/matmul-accel.swift
- Reverse array elements
- Sort array values
- Clear color,
xcode-projects/MetalClear/
- Color view with compute kernel,
xcode-projects/MetalColorCompute/
- Matrix multiplication,
scripts/matmul-metal.swift
- Noise,
xcode-projects/MetalNoise/
- Particles,
xcode-projects/MetalParticles/
- Sampler,
xcode-projects/MetalSampler/
- Triangle,
xcode-projects/MetalTriangle/
If you have questions or find errors in the code examples then please submit an issue. Pull requests for new code examples are not accepted because this repository is for my own personal notes. However, pull requests to fix errors in existing code are welcome.
Support this project by using the ❤️ Sponsor button at the top of this page. Thank you 😄.
Code in this repository is available under the MIT License - see the LICENSE file for more information.