A family that defines the Live Activity's size.
Live Activities support one or more sizes, giving you the
flexibility to configure them for different devices. A Live Activity
renders for a specific family, depending on both the device and the
location in which it's displayed.
A Live Activity initiated on one device can be sent to a remote device
that renders the Live Activity at a different family size. For example,
if your Live Activity is running on an iOS or iPadOS device,
it natively renders with an ``ActivityFamily/medium`` family.
If you want to opt in to customize the rendering for a Live Activity
for the watchOS Smart Stack, use the ``ActivityFamily/small``
family modifier.
When you define your Live Activity's configuration,
specify the sizes your Live Activity supports using the
<doc://com.apple.documentation/documentation/swiftui/widgetconfiguration/supplementalactivityfamilies(_:)>
property modifier.
When you render the content of the Live Activity, use
<doc://com.apple.documentation/documentation/SwiftUI/EnvironmentValues/activityFamily>
to read the current family and lay out your
content appropriately.
The code below uses <doc://com.apple.documentation/documentation/swiftui/widgetconfiguration/supplementalactivityfamilies(_:)>
to specify the size of the Live Activity for devices on iOS and watchOS.
```swift
// A RideSharingActivity that supports the watchOS Smart Stack and the iOS Lock Screen.
struct RideSharingActivity: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: RideAttributes.self) { context in
RideSharingView(context: context)
} dynamicIsland: { context in
DynamicIsland {
DynamicIslandExpandedRegion(.bottom) {
RideShareDetails()
}
} compactLeading: {
AppLogo()
} compactTrailing: {
ETAView()
} minimal: {
ETAView()
}
}
.supplementalActivityFamilies([.small, .medium])
}
}
```
Members (3)
get · iOS 18.0+
description
TypeScript
getDescription($self: ActivityFamily): string
Swift declaration
var description: String { get }
A textual representation of this instance.
Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the `String(describing:)`
initializer. This initializer works with any type, and uses the custom
`description` property for types that conform to
`CustomStringConvertible`:
struct Point: CustomStringConvertible {
let x: Int, y: Int
var description: String {
return "(\(x), \(y))"
}
}
let p = Point(x: 21, y: 30)
let s = String(describing: p)
print(s)
// Prints "(21, 30)"
The conversion of `p` to a string in the assignment to `s` uses the
`Point` type's `description` property.
init · iOS 18.0+
init
TypeScript
init(rawValue: number): (ActivityFamily) | null
Swift declaration
init?(rawValue: Int)
Creates a new instance with the specified raw value.
If there is no value of the type that corresponds with the specified raw
value, this initializer returns `nil`. For example:
enum PaperSize: String {
case A4, A5, Letter, Legal
}
print(PaperSize(rawValue: "Legal"))
// Prints "Optional(PaperSize.Legal)"
print(PaperSize(rawValue: "Tabloid"))
// Prints "nil"
- Parameter rawValue: The raw value to use for the new instance.
get · iOS 18.0+
rawValue
TypeScript
getRawValue($self: ActivityFamily): number
Swift declaration
var rawValue: Int { get }
The corresponding value of the raw type.
A new instance initialized with `rawValue` will be equivalent to this
instance. For example:
enum PaperSize: String {
case A4, A5, Letter, Legal
}
let selectedSize = PaperSize.Letter
print(selectedSize.rawValue)
// Prints "Letter"
print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
// Prints "true"