blob: eb302d894687838cdc5b2aef046b5d0a6e2e934e [file] [log] [blame]
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'config.dart';
/// The iOS SDK (device or simulator) in [IOSCodeConfig.targetSdk].
final class IOSSdk {
/// The type of this [IOSSdk].
///
/// A string such as `iphoneos` or `iphonesimulator`.
final String type;
const IOSSdk._(this.type);
/// The iphoneos SDK in Xcode.
///
/// The SDK location can be found on the host machine with
/// `xcrun --sdk iphoneos --show-sdk-path`.
static const iPhoneOS = IOSSdk._('iphoneos');
/// The iphonesimulator SDK in Xcode.
///
/// The SDK location can be found on the host machine with
/// `xcrun --sdk iphonesimulator --show-sdk-path`.
static const iPhoneSimulator = IOSSdk._('iphonesimulator');
/// All known values for [IOSSdk].
static const values = [iPhoneOS, iPhoneSimulator];
/// The type of this [IOSSdk].
///
/// This returns a stable string that can be used to construct a
/// [IOSSdk] via [IOSSdk.fromString].
factory IOSSdk.fromString(String type) =>
values.firstWhere((e) => e.type == type);
/// The type of this [IOSSdk].
///
/// This returns a stable string that can be used to construct a
/// [IOSSdk] via [IOSSdk.fromString].
@override
String toString() => type;
}