admaDIC App Development & IT Solutions

Welcome to admaDIC's Development Site

SwiftUI Card Flip

by Annett Schwarze | 2025-11-21

A simple card flip animation can be implemented in SwiftUI quite easily. For the flip transformation the modifier `rotation3DEffect()` works nicely.

[more ...]

Details...

Fonts and Bounds

by Annett Schwarze | 2025-11-14

With `NSAttributedString` one can calculate the bounding box of an attributed string when it is rendered. In the example a `UILabel` is used to show the `NSAttributedString` and a `Rectangle` with the size of the string's bounding box is layered under the label.

[more ...]

Details...

TipKit

by Annett Schwarze | 2025-11-06

Apple provides a TipKit framework which allows developers to embed contextual tips and onboarding hints directly within an app.

[more ...]

Details...

SwiftUI ViewModifier

by Annett Schwarze | 2025-10-30

SwiftUI provides so called ViewModifiers. A ViewModifier is a reusable type that defines how to change or decorate a view's appearance or behavior.

[more ...]

Details...

SwiftUI Custom Ring Progress View

by Annett Schwarze | 2025-10-24

A custom ring progress view with color gradient is implemented using `Circle()`, `.stroke` and `.trim`. Two circle paths are layered on top of each other to render the progress track and the actual progress ring.

[more ...]

Details...

SwiftUI Plain Button Background Tap

by Annett Schwarze | 2025-10-17

When using a `SwiftUI` `Button` with `.buttonStyle(.plain)`, the background of the button may not react to tap gestures. One may run into this situation when using a more complex composition of UI elements as a button label. To make the background of the button respond to user interactions, use the modifier `.contentShape()`. Usually `.contentShape(Rectangle())` is a fitting choice.

[more ...]

Details...

Dragging a SwiftUI View

by Annett Schwarze | 2025-10-03

Using `DragGesture` a floating movable `Button` can be easily implemented. Use the `.offset()` view modifier to shift the position of the movable view. Use the `DragGesture` to record dragging events and adjust the offset for the movable view.

[more ...]

Details...

TextEditor and AttributedString TextEditor and AttributedString

by Annett Schwarze | 2025-09-26

With platform versions 26 `TextEditor` now supports `AttributedString` allowing to edit styled text. The data is stored in an `AttributedString` and the `TextEditor` accesses it using a `Binding`. Use the initializer `init(text: Binding< AttributedString >, selection: Binding< AttributedTextSelection >? = nil)` for that.

[more ...]

Details...

Sudoku - Solver Views Sudoku - Solver Views

by Annett Schwarze | 2025-09-19

This article is part of a series in which a Sudoku game is implemented. As a fourth step, the views for the solver are built.

An InputView is added so the user can set a number in a cell. The views are adjusted so the list of allowed numbers is shown in the free cells.

[more ...]

Details...

Sudoku - Solver Sudoku - Solver

by Annett Schwarze | 2025-09-12

This article is part of a series in which a Sudoku game is implemented. As a third step, a solver is built.

The SudokuGenerator is modified and includes a new updateAllowedNumbers function. The SudokuModel is adjusted with new properties to hold state for the solving process.

[more ...]

Details...

Sudoku - Generator Views Sudoku - Generator Views

by Annett Schwarze | 2025-09-05

This article is part of a series in which a Sudoku game is implemented. As a second step, a generator view for showing Sudokus is built.

The SudokuGeneratorView holds a model class SudokuModel and includes Buttons for generating a random sudoku field. The SudokuGenerator is instantiated when needed only.

[more ...]

Details...

Sudoku - Generator Sudoku - Generator

by Annett Schwarze | 2025-08-29

This article is part of a series in which a Sudoku game is implemented. As a first step, a generator to create random Sudokus is built.

The class SudokuGenerator fills a model class SudokuModel with random numbers for a correct sudoku field. A random selection of cells is chosen to be cleared. This approach ensures, that a solution for the sudoku exists.

[more ...]

Details...

Create Morse Code and Play it - Morse Code Views Create Morse Code and Play it - Morse Code Views

by Annett Schwarze | 2025-08-22

This article is part of a series in which a morse code player is implemented. As a third step, the views are built, which tie everything together.

There are two views. A player view for controlling the MorseCodePlayer. The second view is the main view, which holds all model instances and contains the player view.

[more ...]

Details...

Create Morse Code and Play it - Morse Code Player Create Morse Code and Play it - Morse Code Player

by Annett Schwarze | 2025-08-15

This article is part of a series in which a morse code player is implemented. As a second step, a class is implemented, which prepares the beep sounds and can play them.

The `AVFoundation` framework can be used to generate sounds and play them. The short and long beeps are computed using the sinus function.

[more ...]

Details...

Create Morse Code and Play it - Morse Code Creator Create Morse Code and Play it - Morse Code Creator

by Annett Schwarze | 2025-08-08

This article is part of a series in which a morse code player is implemented. As a first step, a class is implemented, which converts text to morse code.

The class MorseCodeCreator creates two outputs. One is an AttributedString with differing colours for each encoded word. The other is a sequence of character, which can be later used to play the morse code with all the typical pauses already in place.

[more ...]

Details...

Swift Networking Simple Request with Query Swift Networking Simple Request

by Annett Schwarze | 2025-08-01

Performing network communication in Swift is enabled using URLSession. A very simple request can be implemented with the asynchronous method `data(from: URL)` using just a couple of code lines.

Parameters for the request can be sent with query parameters. Use `URLComponents` and `URLQueryItem` for that. These types handle conversion of special characters and save you from implementing complicated checks of edge cases.

[more ...]

Details...

Vibe Coding: JavaScript Game Encryption Protolock Vibe Coding: JavaScript Game Encryption Protolock

by Annett Schwarze | 2025-07-25

The project served as a test how well a small game can be implemented using vibe coding. The goal was to create a "light-out puzzle" game using HTML and JavaScript. The inspiration came from a mini game called "Mezzonic Protolock" https://www.wowhead.com/quest=65461/your-first-mezzonic-protolock

[more ...]

Details...

SwiftUI QR Code Generation SwiftUI QR Code Generation

by Annett Schwarze | 2025-07-18

The CoreImage framework provides features to create a QR code. Importing `CIFilterBuiltins` adds access to the function `CIFilter.qrCodeGenerator()`, which returns a QR generator instance.

[more ...]

Details...

Swift Networking IP Location Swift Networking IP Location

by Annett Schwarze | 2025-07-11

The location of an IP-address can be fetched with a very simple request from ip-api.com. With MapKit it is very easy to show it on a map.

[more ...]

Details...

Swift Networking ISS Location Swift Networking ISS Location

by Annett Schwarze | 2025-07-08

The location of the International Space Station can be fetched with a very simple request from api.open-notify.org. With MapKit it is very easy to show it on a map.

[more ...]

Details...

SwiftUI 3D Chart SwiftUI 3D Chart

by Annett Schwarze | 2025-06-27

To create a 3D chart use `Chart3D`. In the example a data array is passed into the Chart3D call. To create a 3D scatter plot use `PointMark`. For a surface plot use `SurfacePlot`.

The feature has been tested with macOS 26 Tahoe and Xcode 26.

[more ...]

Details...

Swift Foundation Models: Chat Swift Foundation Models: Chat

by Annett Schwarze | 2025-06-20

Apple's Foundation Models Framework provides simple access to language models. The sample below shows, how to use a `LanguageModelSession` to send a message and react to a stream of responses.

The feature has been tested on a MacBook with Silicon processor, macOS 26 Tahoe and Xcode 26.

[more ...]

Details...

Swift Networking Simple Request Swift Networking Simple Request

by Annett Schwarze | 2025-06-13

Performing network communication in Swift is enabled using URLSession. A very simple request can be implemented with the asynchronous method `data(from: URL)` using just a couple of code lines.

For easy testing the Python package FastAPI provides a very simple and quick means. That way handling network requests can be tested in the simulator while the server can be started on the developer computer.

[more ...]

Details...

SwiftUI Scatter Charts SwiftUI Scatter Charts

by Annett Schwarze | 2025-06-06

SwiftUI Charts support creating scatter charts. To create a scatter chart, use a `Chart` view and place `PointMark`s or `LineMark`s inside.

[more ...]

Details...

SwiftUI Bar Charts SwiftUI Bar Charts

by Annett Schwarze | 2025-05-30

SwiftUI Charts support creating bar charts. To create a bar chart, use a `Chart` view and place `BarMark`s inside.

[more ...]

Details...

SwiftUI Pie Charts SwiftUI Pie Charts

by Annett Schwarze | 2025-05-23

SwiftUI Charts support creating pie charts since iOS 17. To create a pie chart, use a Chart view and place SectorMarks inside..

[more ...]

Details...

SwiftUI Custom Circular Layout Custom Circular Layout

by Annett Schwarze | 2025-05-16

Custom layouts in SwiftUI are provided using the protocol `Layout`. The `Layout` protocol requires to implement two methods `func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize` and `func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ())`.

[more ...]

Details...

SwiftUI Filtered Table Filtered Table

by Annett Schwarze | 2025-05-09

A Table in SwiftUI is used to present data in rows and columns.

To create a table insert a Table view and nested in there TableColumns. Table data can be filtered and the table will update automatically. However, the filter process itself must be implemented by the developer.

 

[more ...]

Details...

SwiftUI Hierarchical Table Hierarchical Table

by Annett Schwarze | 2025-05-02

A Table in SwiftUI is used to present data in rows and columns. It can display hierarchical data and can be used as a tree view.

To create a table insert a Table view and nested in there TableColumns. To provide hierarchy, add a property to return the children or nil to the data record type and specify its keypath when configuring the Table.

 

[more ...]

Details...

Apple Intelligence ImagePlayground ImagePlayground

by Annett Schwarze | 2025-04-25

ImagePlayground is an AI based image generation tool powered by Apple Intelligence.

To use ImagePlayground in SwiftUI a system sheet can be opened using the view modifier `.imagePlaygroundSheet(isPresented:,concept:,onCompletion:...)`. The feature is available since iOS 18.1.

 

[more ...]

Details...

SwiftUI Transition Transition

by Annett Schwarze | 2025-04-04

Create custom transitions in SwiftUI using the protocol Transition using view modifiers .scaleEffect, .opacity, .rotationEffect, .blur and others.

 

[more ...]

Details...

SwiftUI MeshGradient MeshGradient

by Annett Schwarze | 2025-03-28

SwiftUI MeshGradients offer complex gradients aligned with a grid.

 

[more ...]

Details...

SwiftUI Scroll Effects Scroll Effects

by Annett Schwarze | 2025-03-14

ScrollViews in SwiftUI can be enhanced with scroll effects. To add scroll effects the view modifier .scrollTransition is available. The sample below shows offset effects and rotation effects.

 

[more ...]

Details...

SwiftUI Animations Animation

by Annett Schwarze | 2025-03-14

Basic Animations in SwiftUI can easily be created using state variables and adjusting them within withAnimation blocks. In this example a view's offset is controlled using a drag gesture. When dragging exceeds a threshold, a new animation is started.

 

[more ...]

Details...

SwiftUI Table Table

by Annett Schwarze | 2025-03-07

A Table in SwiftUI is used to present data in rows and columns. It provides features for sorting, selection and more.

To create a table insert a Table view and nested in there TableColumns.

 

[more ...]

Details...

SwiftUI NavigationSplitView NavigationSplitView

by Annett Schwarze | 2025-02-28

NavigationSplitViews can be used with two or three column layout. Selections are managed with NavigationLink(value:,label:) and navigationDestination(for:,destination:). The call to navigationDestination has to be placed in a superview of the NavigationLinks. The destination views of the navigation destinations will be inserted in the next-level container. This may be content or detail.

 

[more ...]

Details...

SwiftUI ColorPicker ColorPicker

by Annett Schwarze | 2025-02-21

A `ColorPicker` is a standard component to select a color. Use it by adding `ColorPicker` and give it a binding to a `Color` state.

 

[more ...]

Details...

SwiftUI Shapes SwiftUI Shapes

by Annett Schwarze | 2025-02-14

Using SwiftUI shapes is simple. Shapes can be added to views by just creating them with Circle(), Rectangle() or one of the others.

 

[more ...]

Details...

Basic SwiftUI Charts Basic SwiftUI Charts Screenshot

by Annett Schwarze | 2025-01-31

Creating a chart is very simple. There is a Chart view and that view has some marks like LineMark views.

 

[more ...]

Details...

www.admadic.de | webmaster@admadic.de | Legal Notice and Trademarks | Privacy
© 2005-2007 - admaDIC | All Rights Reserved
All other trademarks and/or registered trademarks are the property of their respective owners
Last Change: Fri Nov 21 08:17:09 2025 GMT