Cocoa API解説(macOS/iOS)

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。

目次

Views and Controls

INDEX>SwiftUI > Views and Controls

Overview
Views and controls are the visual building blocks of your app’s user interface. Use them to present your app’s content onscreen. Views represent text, images, shapes, custom drawings, and compositions of any and all of these together. Controls enable user interaction with consistent APIs that adapt to their platform and context.

Combine views using containers that specify their visual relationships and hierarchy. Use methods called modifiers to customize the display, behavior, and interactivity of built-in views and those you create for your app.

You apply modifiers to views and controls to:

Control the size, position, and appearance attributes of the view.

Respond to taps, gestures, and other user interactions.

Support drag and drop operations.

Customize animations and transitions.

Set style preferences and other environment data.

For additional information about how to use views and controls, see Human Interface Guidelines.

Topics
Essentials
protocol View
A type that represents a SwiftUI view.

Creating and Combining Views
This tutorial guides you through building Landmarks — an iOS app for discovering and sharing the places you love. You’ll start by building the view that shows a landmark’s details.

Working with UI Controls
In the Landmarks app, users can create a profile to express their personality. To give users the ability to change their profile, you’ll add an edit mode and design the preferences screen.

Text
struct Text
A view that displays one or more lines of read-only text.

struct TextField
A control that displays an editable text interface.

struct SecureField
A control into which the user securely enters private text.

struct Font
An environment-dependent font.

Images
struct Image
A view that displays an environment-dependent image.

Buttons
struct Button
A control that performs an action when triggered.

struct NavigationLink
A button that triggers a navigation presentation when pressed.

struct MenuButton
A button that displays a menu containing a list of choices when pressed.

struct EditButton
A button that toggles the edit mode for the current edit scope.

struct PasteButton
A system button that triggers reading data from the pasteboard.

Value Selectors
struct Toggle
A control that toggles between on and off states.

struct Picker
A control for selecting from a set of mutually exclusive values.

struct DatePicker
A control for selecting an absolute date.

struct Slider
A control for selecting a value from a bounded linear range of values.

struct Stepper
A control used to perform semantic increment and decrement actions.

Supporting Types
struct ViewBuilder
A custom parameter attribute that constructs views from closures.

protocol ViewModifier
A modifier that you apply to a view or another view modifier, producing a different version of the original value.