diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 857c93fd..d2032f1b 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -55,6 +55,37 @@ jobs: with: name: NativeScript-dSYMs path: dist/dSYMs + metadata-generator-tests: + name: Metadata generator tests + runs-on: macos-15 + steps: + - uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0 + with: + xcode-version: ${{env.XCODE_VERSION}} + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false # disable to prevent leaking credentials to build scripts + - name: LLVM cache + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ./llvm + key: ${{ hashFiles('download_llvm.sh') }} + - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 + with: + node-version: "22" + package-manager-cache: false + - name: Build + run: | + ./download_llvm.sh + cmake -S metadata-generator -B metadata-generator/build -DCMAKE_BUILD_TYPE=Release -DMETADATA_BINARY_ARCH=arm64 -DCMAKE_OSX_ARCHITECTURES=arm64 + cmake --build metadata-generator/build -j$(sysctl -n hw.ncpu) --target swift-symbolgraph-tests + # Swift interop: symbol graph loading, classification, compiler + # verification, thunk and TypeScript snapshots (tsc checks the + # declarations). + - name: Swift interop tests + run: | + npm install --no-save --prefix "$RUNNER_TEMP/tsc" typescript@5.9.3 + NS_TSC="$RUNNER_TEMP/tsc/node_modules/.bin/tsc" ./metadata-generator/build/bin/swift-symbolgraph-tests test: name: ${{ matrix.name }} runs-on: macos-15 diff --git a/NativeScript/runtime/DataWrapper.h b/NativeScript/runtime/DataWrapper.h index a98655a5..3ec2b65a 100644 --- a/NativeScript/runtime/DataWrapper.h +++ b/NativeScript/runtime/DataWrapper.h @@ -46,6 +46,7 @@ enum class WrapperType { ExtVector = 1 << 18, Worker = 1 << 19, UnmanagedType = 1 << 20, + SwiftObject = 1 << 21, }; struct V8Args { diff --git a/NativeScript/runtime/IsolateTracked.h b/NativeScript/runtime/IsolateTracked.h index 9767ac84..ea09b71f 100644 --- a/NativeScript/runtime/IsolateTracked.h +++ b/NativeScript/runtime/IsolateTracked.h @@ -41,6 +41,12 @@ class IsolateTracked { } } + protected: + // The bound object while it is alive; empty once collected. + v8::Local TrackedObject(v8::Isolate* isolate) const { + return weakHandle_.Get(isolate); + } + private: static void Finalizer(const v8::WeakCallbackInfo& data) { IsolateTracked* self = data.GetParameter(); diff --git a/NativeScript/runtime/NsBuiltinModules.cpp b/NativeScript/runtime/NsBuiltinModules.cpp index 71124440..f06a42ac 100644 --- a/NativeScript/runtime/NsBuiltinModules.cpp +++ b/NativeScript/runtime/NsBuiltinModules.cpp @@ -10,6 +10,7 @@ #include "ModuleInternalCallbacks.h" #include "Runtime.h" #include "StructuredSerialization.h" +#include "SwiftInterop.h" #include "TextEncoding.h" #include "URLImpl.h" #include "URLSearchParamsImpl.h" @@ -50,6 +51,7 @@ struct Registration { constexpr Registration kRegistry[] = { {"ns:module", BuiltinId::kNsModule, NsModuleBinding}, {"ns:runtime", BuiltinId::kNsRuntime, NsRuntimeBinding}, + {"ns:swift", BuiltinId::kNsSwift, SwiftInterop::CreateBinding}, {"ns:url", BuiltinId::kNsUrl, NsUrlBinding}, {"ns:util", BuiltinId::kNsUtil, NsUtilBinding}, {"ns:worker_threads", BuiltinId::kNsWorkerThreads, NsWorkerThreadsBinding}, @@ -178,6 +180,18 @@ bool HasPrefix(const std::string& specifier, const char* prefix) { return specifier.rfind(prefix, 0) == 0; } +// `ns:swift/`: a Swift module's exports (SwiftInterop.h); the module +// name, not the registry, decides whether it exists. +constexpr const char* kSwiftModulePrefix = "ns:swift/"; + +bool SwiftModuleName(const std::string& specifier, std::string& name) { + if (!HasPrefix(specifier, kSwiftModulePrefix)) { + return false; + } + name = specifier.substr(std::char_traits::length(kSwiftModulePrefix)); + return !name.empty(); +} + MaybeLocal NsModuleBinding(Local context) { Isolate* isolate = v8::Isolate::GetCurrent(); Local binding = Object::New(isolate); @@ -361,6 +375,10 @@ bool NsBuiltinModules::IsNsScheme(const std::string& specifier) { bool NsBuiltinModules::IsRegistered(const std::string& specifier, bool includeInternal) { + std::string swiftModule; + if (SwiftModuleName(specifier, swiftModule)) { + return true; + } const Registration* registration = Find(specifier); return registration != nullptr && (includeInternal || !registration->internalOnly); @@ -372,6 +390,10 @@ std::string NsBuiltinModules::NotFoundMessage(const std::string& specifier) { MaybeLocal NsBuiltinModules::GetExports(Local context, const std::string& specifier) { + std::string swiftModule; + if (SwiftModuleName(specifier, swiftModule)) { + return SwiftInterop::LoadModule(context, swiftModule); + } const Registration* registration = Find(specifier); if (registration == nullptr) { return MaybeLocal(); @@ -413,8 +435,10 @@ MaybeLocal NsBuiltinModules::GetModule(Local context, const std::string& specifier) { // The module system is the app-facing entry point; the internal tier only // exists behind the require builtins receive. + std::string swiftModule; const Registration* registration = Find(specifier); - if (registration == nullptr || registration->internalOnly) { + if (!SwiftModuleName(specifier, swiftModule) && + (registration == nullptr || registration->internalOnly)) { return MaybeLocal(); } diff --git a/NativeScript/runtime/SwiftInterop.h b/NativeScript/runtime/SwiftInterop.h new file mode 100644 index 00000000..a53d994c --- /dev/null +++ b/NativeScript/runtime/SwiftInterop.h @@ -0,0 +1,282 @@ +#ifndef SwiftInterop_h +#define SwiftInterop_h + +#include +#include + +#ifdef __cplusplus +#include + +#include "Common.h" +#endif + +// Binary contract between the runtime and Swift thunks generated by the +// metadata generator (metadata-generator/src/Swift/ThunkEmitter.cpp). +// +// Generated Swift does not import this header: it reads these layouts with +// `load(fromByteOffset:as:)`, so every offset below is part of the contract. +// Any change to a layout, an API table slot, a tag, a kind or a signature +// code requires bumping NS_SWIFT_ABI_VERSION in both places. +// +// A Swift module `M` exposes one C symbol, `ns_swift_register_M`, taking an +// NSSwiftRegistrar*. It registers the module, its types and its members with +// the API table's register* entries. Each member carries a thunk: +// +// void thunk(NSSwiftCall* call, const NSSwiftValue* args, intptr_t count) +// +// For instance members args[0] is the receiver. A setter thunk receives the +// new value last. Before calling a thunk the runtime has checked every +// argument's tag and integer range against the member's signature, so a thunk +// may rely on them; it still validates object types and enum case names +// itself (throwTypeError). A thunk reports its outcome by calling exactly one +// return* or throw* entry of call->api, or calls beginAsync and later +// exactly one complete* entry with the token it returned (from any thread). +// +// A closure argument is a callback handle, borrowed for the call. A Swift +// closure that captures it holds a reference (callbackRetain/Release) and +// calls it by reporting the arguments as an array: callbackBegin, each +// argument through the complete* entries, then completeArrayEnd. + +#define NS_SWIFT_ABI_VERSION 7 + +#ifdef __cplusplus +extern "C" { +#endif + +// 24 bytes: tag at 0, payload at 8, string byte length at 16. +typedef struct NSSwiftValue { + uint32_t tag; + uint32_t reserved; + union { + uint8_t boolean; + int64_t int64; + uint64_t uint64; + double float64; + const uint8_t* utf8; + void* object; + } payload; + uint64_t length; +} NSSwiftValue; + +enum { + NSSwiftTagNull = 0, + NSSwiftTagBool = 1, + NSSwiftTagInt64 = 2, + NSSwiftTagUInt64 = 3, + NSSwiftTagDouble = 4, + // UTF-8 bytes, not NUL-terminated, valid for the duration of the call. + NSSwiftTagString = 5, + // A Swift object borrowed (+0) for the duration of the call. + NSSwiftTagObject = 6, + // payload.object points at `length` element slots. + NSSwiftTagArray = 7, + // payload.object points at 2 * `length` slots: key, value, key, value... + // Keys are strings. + NSSwiftTagMap = 8, + // payload.object is a callback handle. + NSSwiftTagFunction = 9, + // An enum with associated values: payload.object points at `length` + // slots, the case index (NSSwiftTagInt64) then the case's values. + NSSwiftTagCase = 10, + // An Objective-C object borrowed (+0) for the duration of the call. + NSSwiftTagObjC = 11, +}; + +typedef struct NSSwiftAPI NSSwiftAPI; + +// Runtime-owned; generated code reads only `api`. +typedef struct NSSwiftCall { + const NSSwiftAPI* api; +} NSSwiftCall; + +typedef struct NSSwiftRegistrar { + const NSSwiftAPI* api; +} NSSwiftRegistrar; + +typedef void (*NSSwiftThunk)(NSSwiftCall* call, const NSSwiftValue* args, + intptr_t count); +typedef void (*NSSwiftRelease)(void* object); + +enum { + NSSwiftTypeClass = 0, + NSSwiftTypeActor = 1, + NSSwiftTypeStruct = 2, + NSSwiftTypeEnum = 3, + // An enum with associated values. + NSSwiftTypeTaggedEnum = 4, +}; + +enum { + NSSwiftMemberInitializer = 0, + NSSwiftMemberInstanceMethod = 1, + NSSwiftMemberStaticMethod = 2, + NSSwiftMemberInstanceProperty = 3, + NSSwiftMemberStaticProperty = 4, + NSSwiftMemberFunction = 5, + NSSwiftMemberVariable = 6, + NSSwiftMemberEnumCase = 7, +}; + +enum { + NSSwiftMemberThrows = 1 << 0, + NSSwiftMemberSettable = 1 << 1, + // Another overload with the same JS name accepts the same JS argument + // kinds; JS can only reach it through its signature key. + NSSwiftMemberAmbiguous = 1 << 2, + // The call settles a Promise (beginAsync). + NSSwiftMemberAsync = 1 << 3, + // Isolated to the main actor; the thunk rejects calls from other threads. + NSSwiftMemberMainActor = 1 << 4, +}; + +// Member signatures: comma-separated parameter codes, '>', result code. +// v void (results only) +// b Bool +// i8 i16 i32 i64 u8 u16 u32 u64 +// integers; JS numbers within +/-(2^53 - 1), or BigInt +// f32 f64 floating point +// s String +// o object of type index n (class instance, or boxed struct) +// e payload-less enum of type index n, as its case name +// t enum with associated values of type index n +// (NSSwiftTagCase) <-> plain JS object copy naming its case, +// { case: "area", width: 3, height: 4 } +// D Date: a double of milliseconds since 1970 <-> JS Date +// U URL: its string <-> JS URL (strings accepted as input) +// B Data: bytes (NSSwiftTagString) <-> Uint8Array copy +// [] array (NSSwiftTagArray) <-> JS array copy +// {} [String: ] (NSSwiftTagMap) <-> plain JS object copy +// (,...) +// closure returning Void, of the listed parameters +// (NSSwiftTagFunction) <- JS function; parameters only +// @ instance of Objective-C class (its runtime name) +// (NSSwiftTagObjC) <-> NativeScript's Objective-C wrapper +// ? optional: JS null/undefined <-> NSSwiftTagNull +// & inout parameter: JS passes a reference object `{ value }`; +// the slot holds its value, and a successful call reports the +// final value (writeBackBegin) into it +// e.g. "s,i64>s" is (String, Int) -> String; ">o2?" returns an optional +// instance of type 2. +// +// A tagged enum's cases register as its NSSwiftMemberEnumCase members with +// their associated values as parameters ("f64,f64>t2" for +// `area(width:height:)`); a case's index is its position among them. JS keys +// a value by its label, by "value" when it is a case's only, unlabeled value, +// and by its position otherwise. + +// Function pointer table. Slot n is at byte offset n * 8; slots are only +// ever appended. +struct NSSwiftAPI { + /* 0 */ void (*returnVoid)(NSSwiftCall* call); + /* 1 */ void (*returnBool)(NSSwiftCall* call, uint8_t value); + /* 2 */ void (*returnInt64)(NSSwiftCall* call, int64_t value); + /* 3 */ void (*returnUInt64)(NSSwiftCall* call, uint64_t value); + /* 4 */ void (*returnDouble)(NSSwiftCall* call, double value); + /* 5 */ void (*returnString)(NSSwiftCall* call, const uint8_t* utf8, + intptr_t length); + /* 6 */ void (*returnNull)(NSSwiftCall* call); + // `object` is retained (+1); the runtime takes ownership. `typeIndex` is + // the dynamic type (a subclass of the declared type, or the boxed struct). + /* 7 */ void (*returnObject)(NSSwiftCall* call, void* object, + uint32_t typeIndex); + // A Swift error: String(describing:) of the error and its type name. + /* 8 */ void (*throwError)(NSSwiftCall* call, const uint8_t* message, + intptr_t messageLength, const uint8_t* type, + intptr_t typeLength); + /* 9 */ void (*throwTypeError)(NSSwiftCall* call, const uint8_t* message, + intptr_t length); + /* 10 */ void (*registerModule)(NSSwiftRegistrar* registrar, + uint32_t abiVersion, const char* name, + const char* fingerprint, + NSSwiftRelease release); + // `superIndex` is the type index of a registered superclass, or -1. + /* 11 */ void (*registerType)(NSSwiftRegistrar* registrar, uint32_t index, + uint32_t kind, const char* jsName, + const char* swiftName, int32_t superIndex); + // `owner` is a type index, or -1 for module-level functions and variables. + /* 12 */ void (*registerMember)(NSSwiftRegistrar* registrar, int32_t owner, + uint32_t kind, uint32_t flags, + const char* jsName, const char* swiftName, + const char* signature, NSSwiftThunk thunk, + NSSwiftThunk setter); + + // Async calls. beginAsync makes the call's JS result a Promise and returns + // a token; exactly one complete* entry settles it. Those may be called from + // any thread: the outcome is delivered on the isolate's thread, and dropped + // (releasing any object) if the isolate is gone by then. + /* 13 */ void* (*beginAsync)(NSSwiftCall* call); + /* 14 */ void (*completeVoid)(void* token); + /* 15 */ void (*completeBool)(void* token, uint8_t value); + /* 16 */ void (*completeInt64)(void* token, int64_t value); + /* 17 */ void (*completeUInt64)(void* token, uint64_t value); + /* 18 */ void (*completeDouble)(void* token, double value); + /* 19 */ void (*completeString)(void* token, const uint8_t* utf8, + intptr_t length); + /* 20 */ void (*completeNull)(void* token); + /* 21 */ void (*completeObject)(void* token, void* object, + uint32_t typeIndex); + /* 22 */ void (*completeError)(void* token, const uint8_t* message, + intptr_t messageLength, const uint8_t* type, + intptr_t typeLength); + + // Collections are reported element by element: Begin, then each element + // through the ordinary return*/complete* entries (for a map: key, then + // value), then End. Collections nest. + /* 23 */ void (*returnArrayBegin)(NSSwiftCall* call, intptr_t count); + /* 24 */ void (*returnArrayEnd)(NSSwiftCall* call); + /* 25 */ void (*returnMapBegin)(NSSwiftCall* call, intptr_t count); + /* 26 */ void (*returnMapEnd)(NSSwiftCall* call); + /* 27 */ void (*completeArrayBegin)(void* token, intptr_t count); + /* 28 */ void (*completeArrayEnd)(void* token); + /* 29 */ void (*completeMapBegin)(void* token, intptr_t count); + /* 30 */ void (*completeMapEnd)(void* token); + + // Closures. callbackBegin returns a token for one invocation; it is + // consumed by completeArrayEnd once the arguments are reported. Any entry + // may be called from any thread: a call on the isolate's thread runs the + // function before returning, any other is queued to that thread (Swift + // does not wait for it). + /* 31 */ void* (*callbackBegin)(void* callback); + /* 32 */ void (*callbackRetain)(void* callback); + /* 33 */ void (*callbackRelease)(void* callback); + + // Tagged enum values are reported like collections: Begin with the case + // index, the case's values through the return*/complete* entries, End. + /* 34 */ void (*returnCaseBegin)(NSSwiftCall* call, intptr_t caseIndex); + /* 35 */ void (*completeCaseBegin)(void* token, intptr_t caseIndex); + /* 36 */ void (*returnCaseEnd)(NSSwiftCall* call); + /* 37 */ void (*completeCaseEnd)(void* token); + + // The final value of inout argument `index` (0 is the first parameter, + // not the receiver): Begin, the value through the return* entries, End. + // Reported before the call's result. + /* 38 */ void (*writeBackBegin)(NSSwiftCall* call, intptr_t index); + /* 39 */ void (*writeBackEnd)(NSSwiftCall* call); + + // An Objective-C object, retained (+1); the runtime takes ownership. + /* 40 */ void (*returnObjC)(NSSwiftCall* call, void* object); + /* 41 */ void (*completeObjC)(void* token, void* object); +}; + +typedef void (*NSSwiftRegisterFunction)(NSSwiftRegistrar* registrar); + +#ifdef __cplusplus +} // extern "C" + +namespace tns { +namespace SwiftInterop { + +// The `ns:swift` builtin's native binding. +v8::MaybeLocal CreateBinding(v8::Local context); + +// The frozen exports of Swift module `name` (`ns:swift/`), built once +// per isolate. Empty with a pending exception when the module is not linked +// or invalid. +v8::MaybeLocal LoadModule(v8::Local context, + const std::string& name); + +} // namespace SwiftInterop +} // namespace tns +#endif + +#endif /* SwiftInterop_h */ diff --git a/NativeScript/runtime/SwiftInterop.mm b/NativeScript/runtime/SwiftInterop.mm new file mode 100644 index 00000000..c71dba38 --- /dev/null +++ b/NativeScript/runtime/SwiftInterop.mm @@ -0,0 +1,2853 @@ +#include "SwiftInterop.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ArgConverter.h" +#include "Caches.h" +#include "DataWrapper.h" +#include "EventLoop.h" +#include "Helpers.h" +#include "IsolateTracked.h" +#include "IsolateWrapper.h" +#include "NativeScriptException.h" +#include "NativeScriptPlatform.h" +#include "robin_hood.h" + +using namespace v8; + +namespace tns { +namespace SwiftInterop { + +namespace { + +// Largest integer magnitude a JS number represents exactly. +constexpr double kMaxSafeInteger = 9007199254740991.0; + +// --- Signatures -------------------------------------------------------------- + +struct ValueCode { + enum class Kind { + Void, + Bool, + Signed, + Unsigned, + Float, + String, + Object, + Enum, + Date, + URL, + Data, + Array, + Map, + Function, + Tagged, + ObjC, + }; + Kind kind = Kind::Void; + int bits = 64; + int typeIndex = -1; + bool optional = false; + // A parameter passed as a reference object (`&` prefix). + bool inout = false; + // ObjC: the class's runtime name, and the class when it is loaded. + std::string className; + Class objcClass = nil; + // Array and Map: the element (value) code. Function: its parameter codes. + std::vector element; +}; + +// Splits "a,[b],(c,d)" at its top-level commas. +bool SplitCodes(const std::string& text, std::vector& parts) { + int depth = 0; + size_t start = 0; + for (size_t i = 0; i < text.size(); i++) { + char c = text[i]; + if (c == '[' || c == '{' || c == '(') { + depth++; + } else if (c == ']' || c == '}' || c == ')') { + if (--depth < 0) { + return false; + } + } else if (c == ',' && depth == 0) { + parts.push_back(text.substr(start, i - start)); + start = i + 1; + } + } + if (depth != 0) { + return false; + } + if (!text.empty()) { + parts.push_back(text.substr(start)); + } + return true; +} + +bool ParseCode(std::string text, ValueCode& code) { + if (!text.empty() && text.back() == '?') { + code.optional = true; + text.pop_back(); + } + if (text.empty()) { + return false; + } + if ((text.front() == '[' && text.back() == ']') || (text.front() == '{' && text.back() == '}')) { + code.kind = text.front() == '[' ? ValueCode::Kind::Array : ValueCode::Kind::Map; + code.element.emplace_back(); + ValueCode& element = code.element.back(); + return ParseCode(text.substr(1, text.size() - 2), element) && + element.kind != ValueCode::Kind::Void && element.kind != ValueCode::Kind::Function && + !element.optional; + } + if (text.front() == '(' && text.back() == ')') { + code.kind = ValueCode::Kind::Function; + std::vector parts; + if (!SplitCodes(text.substr(1, text.size() - 2), parts)) { + return false; + } + for (const std::string& part : parts) { + code.element.emplace_back(); + ValueCode& parameter = code.element.back(); + if (!ParseCode(part, parameter) || parameter.kind == ValueCode::Kind::Void || + parameter.kind == ValueCode::Kind::Function) { + return false; + } + } + return true; + } + auto number = [](const std::string& digits, int& out) { + if (digits.empty() || digits.size() > 6) { + return false; + } + for (char c : digits) { + if (c < '0' || c > '9') { + return false; + } + } + out = std::stoi(digits); + return true; + }; + switch (text[0]) { + case 'v': + code.kind = ValueCode::Kind::Void; + return text.size() == 1; + case 'b': + code.kind = ValueCode::Kind::Bool; + return text.size() == 1; + case 's': + code.kind = ValueCode::Kind::String; + return text.size() == 1; + case 'D': + code.kind = ValueCode::Kind::Date; + return text.size() == 1; + case 'U': + code.kind = ValueCode::Kind::URL; + return text.size() == 1; + case 'B': + code.kind = ValueCode::Kind::Data; + return text.size() == 1; + case 'i': + case 'u': + code.kind = text[0] == 'i' ? ValueCode::Kind::Signed : ValueCode::Kind::Unsigned; + return number(text.substr(1), code.bits) && + (code.bits == 8 || code.bits == 16 || code.bits == 32 || code.bits == 64); + case 'f': + code.kind = ValueCode::Kind::Float; + return number(text.substr(1), code.bits) && (code.bits == 32 || code.bits == 64); + case 'o': + code.kind = ValueCode::Kind::Object; + return number(text.substr(1), code.typeIndex); + case 'e': + code.kind = ValueCode::Kind::Enum; + return number(text.substr(1), code.typeIndex); + case 't': + code.kind = ValueCode::Kind::Tagged; + return number(text.substr(1), code.typeIndex); + case '@': + code.kind = ValueCode::Kind::ObjC; + code.className = text.substr(1); + code.objcClass = NSClassFromString([NSString stringWithUTF8String:code.className.c_str()]); + return !code.className.empty(); + default: + return false; + } +} + +// The code map keys are reported with. +const ValueCode& KeyCode() { + static const ValueCode code = [] { + ValueCode key; + key.kind = ValueCode::Kind::String; + return key; + }(); + return code; +} + +struct Signature { + std::vector parameters; + ValueCode result; +}; + +bool ParseSignature(const std::string& text, Signature& signature) { + size_t arrow = text.find('>'); + if (arrow == std::string::npos) { + return false; + } + std::vector parts; + if (!SplitCodes(text.substr(0, arrow), parts)) { + return false; + } + for (const std::string& part : parts) { + ValueCode code; + bool inout = !part.empty() && part[0] == '&'; + if (!ParseCode(inout ? part.substr(1) : part, code) || code.kind == ValueCode::Kind::Void || + (inout && code.kind == ValueCode::Kind::Function)) { + return false; + } + code.inout = inout; + signature.parameters.push_back(code); + } + return ParseCode(text.substr(arrow + 1), signature.result) && + signature.result.kind != ValueCode::Kind::Function; +} + +// "greet(name:times:)" -> {"name", "times"}; "describe(_:)" -> {""}. +std::vector LabelsOf(const std::string& swiftName) { + std::vector labels; + size_t open = swiftName.find('('); + if (open == std::string::npos || swiftName.back() != ')') { + return labels; + } + std::string inner = swiftName.substr(open + 1, swiftName.size() - open - 2); + size_t start = 0; + while (start < inner.size()) { + size_t colon = inner.find(':', start); + if (colon == std::string::npos) { + break; + } + std::string label = inner.substr(start, colon - start); + labels.push_back(label == "_" ? "" : label); + start = colon + 1; + } + return labels; +} + +// --- Process-wide module registry --------------------------------------------- +// +// Registration data (names, signatures, thunk pointers) is immutable once a +// module is registered, so every isolate shares it. + +struct ModuleInfo; + +struct MemberInfo { + int owner = -1; + uint32_t kind = 0; + uint32_t flags = 0; + std::string jsName; + std::string swiftName; + std::string signatureText; + Signature signature; + std::vector labels; + NSSwiftThunk thunk = nullptr; + NSSwiftThunk setter = nullptr; +}; + +// Overloads sharing one JS name on one owner. +struct MemberGroup { + const ModuleInfo* module = nullptr; + int owner = -1; + uint32_t kind = 0; + std::string jsName; + std::vector overloads; +}; + +// One case of a tagged enum: its JS keys and value codes, by position. +struct CaseInfo { + std::string name; + std::vector keys; + std::vector codes; +}; + +struct TypeInfo { + uint32_t index = 0; + uint32_t kind = 0; + std::string jsName; + std::string swiftName; + int superIndex = -1; + const ModuleInfo* module = nullptr; + // Initializers (`new Type(...)`), or null when the type has none. + const MemberGroup* initializers = nullptr; + // NSSwiftTypeTaggedEnum: the cases, by case index. + std::vector cases; +}; + +bool IsEnumKind(uint32_t kind) { return kind == NSSwiftTypeEnum || kind == NSSwiftTypeTaggedEnum; } + +struct ModuleInfo { + std::string name; + std::string fingerprint; + uint32_t abiVersion = 0; + NSSwiftRelease release = nullptr; + std::vector types; + std::vector members; + std::vector> groups; + std::string error; + + bool IsA(uint32_t typeIndex, int expected) const { + for (int current = static_cast(typeIndex); current >= 0; + current = types[current].superIndex) { + if (current == expected) { + return true; + } + } + return false; + } +}; + +struct Registrar : NSSwiftRegistrar { + ModuleInfo* module; +}; + +std::string TypeDisplayName(const ModuleInfo& module, const ValueCode& code) { + std::string name; + switch (code.kind) { + case ValueCode::Kind::Void: + name = "Void"; + break; + case ValueCode::Kind::Bool: + name = "Bool"; + break; + case ValueCode::Kind::Signed: + name = code.bits == 64 ? "Int" : "Int" + std::to_string(code.bits); + break; + case ValueCode::Kind::Unsigned: + name = code.bits == 64 ? "UInt" : "UInt" + std::to_string(code.bits); + break; + case ValueCode::Kind::Float: + name = code.bits == 32 ? "Float" : "Double"; + break; + case ValueCode::Kind::String: + name = "String"; + break; + case ValueCode::Kind::Date: + name = "Date"; + break; + case ValueCode::Kind::URL: + name = "URL"; + break; + case ValueCode::Kind::Data: + name = "Data"; + break; + case ValueCode::Kind::Array: + name = "[" + TypeDisplayName(module, code.element.at(0)) + "]"; + break; + case ValueCode::Kind::Map: + name = "[String: " + TypeDisplayName(module, code.element.at(0)) + "]"; + break; + case ValueCode::Kind::Object: + case ValueCode::Kind::Enum: + case ValueCode::Kind::Tagged: + name = code.typeIndex >= 0 && code.typeIndex < static_cast(module.types.size()) + ? module.types[code.typeIndex].jsName + : "?"; + break; + case ValueCode::Kind::Function: + name = "("; + for (size_t i = 0; i < code.element.size(); i++) { + name += (i > 0 ? ", " : "") + TypeDisplayName(module, code.element[i]); + } + name += ") -> Void"; + if (code.optional) { + name = "(" + name + ")"; + } + break; + case ValueCode::Kind::ObjC: + name = code.className; + break; + } + return (code.inout ? "inout " : "") + (code.optional ? name + "?" : name); +} + +// "scale(by: Double)": distinguishes overloads that share a Swift name. +std::string TypedKey(const ModuleInfo& module, const MemberInfo& member) { + std::string base = member.swiftName.substr(0, member.swiftName.find('(')); + std::string key = base + "("; + for (size_t i = 0; i < member.signature.parameters.size(); i++) { + if (i > 0) { + key += ", "; + } + std::string label = i < member.labels.size() ? member.labels[i] : ""; + key += (label.empty() ? "_" : label) + ": " + + TypeDisplayName(module, member.signature.parameters[i]); + } + return key + ")"; +} + +void ApiRegisterModule(NSSwiftRegistrar* registrar, uint32_t abiVersion, const char* name, + const char* fingerprint, NSSwiftRelease release) { + ModuleInfo* module = static_cast(registrar)->module; + module->abiVersion = abiVersion; + if (name != nullptr && module->name != name) { + module->error = "registers as '" + std::string(name) + "'"; + } + module->fingerprint = fingerprint ? fingerprint : ""; + module->release = release; +} + +void ApiRegisterType(NSSwiftRegistrar* registrar, uint32_t index, uint32_t kind, const char* jsName, + const char* swiftName, int32_t superIndex) { + ModuleInfo* module = static_cast(registrar)->module; + if (index != module->types.size()) { + module->error = "type indices are not dense"; + return; + } + TypeInfo type; + type.index = index; + type.kind = kind; + type.jsName = jsName ? jsName : ""; + type.swiftName = swiftName ? swiftName : ""; + type.superIndex = superIndex; + module->types.push_back(std::move(type)); +} + +void ApiRegisterMember(NSSwiftRegistrar* registrar, int32_t owner, uint32_t kind, uint32_t flags, + const char* jsName, const char* swiftName, const char* signature, + NSSwiftThunk thunk, NSSwiftThunk setter) { + ModuleInfo* module = static_cast(registrar)->module; + MemberInfo member; + member.owner = owner; + member.kind = kind; + member.flags = flags; + member.jsName = jsName ? jsName : ""; + member.swiftName = swiftName ? swiftName : ""; + member.signatureText = signature ? signature : ""; + member.labels = LabelsOf(member.swiftName); + member.thunk = thunk; + member.setter = setter; + if (!ParseSignature(member.signatureText, member.signature)) { + module->error = "invalid signature '" + member.signatureText + "' for " + member.swiftName; + return; + } + if (kind == NSSwiftMemberEnumCase && owner >= 0 && + owner < static_cast(module->types.size()) && + module->types[owner].kind == NSSwiftTypeTaggedEnum) { + const auto& codes = member.signature.parameters; + if (member.labels.size() != codes.size()) { + module->error = "case " + member.swiftName + " does not match its signature"; + return; + } + CaseInfo info; + info.name = member.jsName; + info.codes = codes; + for (size_t i = 0; i < codes.size(); i++) { + std::string key = !member.labels[i].empty() ? member.labels[i] + : codes.size() == 1 ? "value" + : std::to_string(i); + if (key == "case") { + module->error = "case " + member.swiftName + " has a value keyed 'case'"; + return; + } + info.keys.push_back(key); + } + module->types[owner].cases.push_back(std::move(info)); + } + module->members.push_back(std::move(member)); +} + +struct CallContext; +void ApiReturnVoid(NSSwiftCall* call); +void ApiReturnBool(NSSwiftCall* call, uint8_t value); +void ApiReturnInt64(NSSwiftCall* call, int64_t value); +void ApiReturnUInt64(NSSwiftCall* call, uint64_t value); +void ApiReturnDouble(NSSwiftCall* call, double value); +void ApiReturnString(NSSwiftCall* call, const uint8_t* utf8, intptr_t length); +void ApiReturnNull(NSSwiftCall* call); +void ApiReturnObject(NSSwiftCall* call, void* object, uint32_t typeIndex); +void ApiThrowError(NSSwiftCall* call, const uint8_t* message, intptr_t messageLength, + const uint8_t* type, intptr_t typeLength); +void ApiThrowTypeError(NSSwiftCall* call, const uint8_t* message, intptr_t length); +void* ApiBeginAsync(NSSwiftCall* call); +void ApiCompleteVoid(void* token); +void ApiCompleteBool(void* token, uint8_t value); +void ApiCompleteInt64(void* token, int64_t value); +void ApiCompleteUInt64(void* token, uint64_t value); +void ApiCompleteDouble(void* token, double value); +void ApiCompleteString(void* token, const uint8_t* utf8, intptr_t length); +void ApiCompleteNull(void* token); +void ApiCompleteObject(void* token, void* object, uint32_t typeIndex); +void ApiCompleteError(void* token, const uint8_t* message, intptr_t messageLength, + const uint8_t* type, intptr_t typeLength); +void ApiReturnArrayBegin(NSSwiftCall* call, intptr_t count); +void ApiReturnArrayEnd(NSSwiftCall* call); +void ApiReturnMapBegin(NSSwiftCall* call, intptr_t count); +void ApiReturnMapEnd(NSSwiftCall* call); +void ApiCompleteArrayBegin(void* token, intptr_t count); +void ApiCompleteMapBegin(void* token, intptr_t count); +void ApiCompleteContainerEnd(void* token); +void* ApiCallbackBegin(void* callback); +void ApiCallbackRetain(void* callback); +void ApiCallbackRelease(void* callback); +void ApiReturnCaseBegin(NSSwiftCall* call, intptr_t caseIndex); +void ApiCompleteCaseBegin(void* token, intptr_t caseIndex); +void ApiWriteBackBegin(NSSwiftCall* call, intptr_t index); +void ApiWriteBackEnd(NSSwiftCall* call); +void ApiReturnObjC(NSSwiftCall* call, void* object); +void ApiCompleteObjC(void* token, void* object); + +const NSSwiftAPI kAPI = { + ApiReturnVoid, ApiReturnBool, ApiReturnInt64, + ApiReturnUInt64, ApiReturnDouble, ApiReturnString, + ApiReturnNull, ApiReturnObject, ApiThrowError, + ApiThrowTypeError, ApiRegisterModule, ApiRegisterType, + ApiRegisterMember, ApiBeginAsync, ApiCompleteVoid, + ApiCompleteBool, ApiCompleteInt64, ApiCompleteUInt64, + ApiCompleteDouble, ApiCompleteString, ApiCompleteNull, + ApiCompleteObject, ApiCompleteError, ApiReturnArrayBegin, + ApiReturnArrayEnd, ApiReturnMapBegin, ApiReturnMapEnd, + ApiCompleteArrayBegin, ApiCompleteContainerEnd, ApiCompleteMapBegin, + ApiCompleteContainerEnd, ApiCallbackBegin, ApiCallbackRetain, + ApiCallbackRelease, ApiReturnCaseBegin, ApiCompleteCaseBegin, + ApiReturnArrayEnd, ApiCompleteContainerEnd, ApiWriteBackBegin, + ApiWriteBackEnd, ApiReturnObjC, ApiCompleteObjC, +}; + +// "Polygon.Style" -> "Style". +std::string LastComponent(const std::string& path) { + size_t dot = path.rfind('.'); + return dot == std::string::npos ? path : path.substr(dot + 1); +} + +bool IsValidModuleName(const std::string& name) { + if (name.empty()) { + return false; + } + for (char c : name) { + bool valid = + (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_'; + if (!valid) { + return false; + } + } + return true; +} + +void BuildGroups(ModuleInfo& module) { + robin_hood::unordered_map byKey; + for (const MemberInfo& member : module.members) { + std::string key = + std::to_string(member.owner) + ":" + std::to_string(member.kind) + ":" + member.jsName; + auto it = byKey.find(key); + MemberGroup* group; + if (it == byKey.end()) { + module.groups.push_back(std::make_unique()); + group = module.groups.back().get(); + group->module = &module; + group->owner = member.owner; + group->kind = member.kind; + group->jsName = member.jsName; + byKey.emplace(key, group); + } else { + group = it->second; + } + group->overloads.push_back(&member); + if (member.kind == NSSwiftMemberInitializer && member.owner >= 0) { + module.types[member.owner].initializers = group; + } + } + + // A subclass's method shadows the superclass property of the same name in + // JS, so it must also carry the inherited overloads it does not override + // (an override keeps the Swift name and signature). + for (const auto& group : module.groups) { + if (group->kind != NSSwiftMemberInstanceMethod || group->owner < 0) { + continue; + } + for (int ancestor = module.types[group->owner].superIndex; ancestor >= 0; + ancestor = module.types[ancestor].superIndex) { + auto inherited = byKey.find(std::to_string(ancestor) + ":" + std::to_string(group->kind) + + ":" + group->jsName); + if (inherited == byKey.end()) { + continue; + } + for (const MemberInfo* candidate : inherited->second->overloads) { + bool overridden = false; + for (const MemberInfo* own : group->overloads) { + overridden |= own->swiftName == candidate->swiftName && + own->signatureText == candidate->signatureText; + } + if (!overridden) { + group->overloads.push_back(candidate); + } + } + } + } +} + +std::string Validate(const ModuleInfo& module) { + if (!module.error.empty()) { + return module.error; + } + if (module.abiVersion != NS_SWIFT_ABI_VERSION) { + return "was generated for Swift interop ABI " + std::to_string(module.abiVersion) + + ", the runtime implements ABI " + std::to_string(NS_SWIFT_ABI_VERSION) + + "; regenerate its thunks"; + } + if (module.release == nullptr) { + return "registered no release function"; + } + auto validType = [&](int index) { + return index >= 0 && index < static_cast(module.types.size()); + }; + for (const TypeInfo& type : module.types) { + if (type.superIndex != -1 && !validType(type.superIndex)) { + return "type " + type.swiftName + " has an invalid superclass index"; + } + } + for (const MemberInfo& member : module.members) { + if (member.owner != -1 && !validType(member.owner)) { + return member.swiftName + " has an invalid owner"; + } + std::vector codes; + for (const auto& parameter : member.signature.parameters) { + codes.push_back(¶meter); + } + codes.push_back(&member.signature.result); + while (!codes.empty()) { + const ValueCode* code = codes.back(); + codes.pop_back(); + if ((code->kind == ValueCode::Kind::Object || code->kind == ValueCode::Kind::Enum) && + !validType(code->typeIndex)) { + return member.swiftName + " references an unknown type"; + } + if (code->kind == ValueCode::Kind::Tagged && + (!validType(code->typeIndex) || + module.types[code->typeIndex].kind != NSSwiftTypeTaggedEnum)) { + return member.swiftName + " references an unknown enum"; + } + for (const auto& element : code->element) { + codes.push_back(&element); + } + } + if (member.kind != NSSwiftMemberEnumCase && member.thunk == nullptr) { + return member.swiftName + " has no thunk"; + } + } + return ""; +} + +std::mutex gModulesMutex; +robin_hood::unordered_map> gModules; + +std::shared_ptr LoadModuleInfo(const std::string& name, std::string& error) { + std::lock_guard lock(gModulesMutex); + auto existing = gModules.find(name); + if (existing != gModules.end()) { + if (!existing->second->error.empty()) { + error = existing->second->error; + return nullptr; + } + return existing->second; + } + + auto module = std::make_shared(); + module->name = name; + std::string symbol = "ns_swift_register_" + name; + auto registerFunction = + reinterpret_cast(dlsym(RTLD_DEFAULT, symbol.c_str())); + if (registerFunction == nullptr) { + module->error = + "Swift module '" + name + "' is not linked into this app (" + symbol + " not found)"; + } else { + Registrar registrar; + registrar.api = &kAPI; + registrar.module = module.get(); + registerFunction(®istrar); + std::string problem = Validate(*module); + if (!problem.empty()) { + module->error = "Swift module '" + name + "' " + problem; + } else { + BuildGroups(*module); + } + } + gModules.emplace(name, module); + if (!module->error.empty()) { + error = module->error; + return nullptr; + } + return module; +} + +// --- Per-isolate state --------------------------------------------------------- + +class SwiftObjectWrapper; + +struct LoadedModule { + std::shared_ptr info; + Global exports; + // Constructor templates by type index; empty for enums. + std::vector> templates; +}; + +// An async call's Promise, settled on the isolate's thread. +struct PendingAsync { + Global resolver; + const MemberInfo* member; +}; + +struct IsolateState { + robin_hood::unordered_map> modules; + // Resolvers stay here, on the isolate's thread: a v8::Global must not be + // destroyed by the thread that completes the call. + robin_hood::unordered_map> pending; + uint64_t nextAsyncId = 1; + robin_hood::unordered_map byInfo; + // Swift object -> its JS wrapper, so a Swift object has one JS identity. + robin_hood::unordered_map identity; + // Thunk calls in progress on the isolate's thread, innermost last. + std::vector calls; +}; + +// Owns one retain of a Swift object for as long as its JS wrapper lives. +class SwiftObjectWrapper : public BaseDataWrapper, public IsolateTracked { + public: + SwiftObjectWrapper(Isolate* isolate, const ModuleInfo* module, void* object, uint32_t typeIndex) + : isolate_(isolate), module_(module), object_(object), typeIndex_(typeIndex) {} + + ~SwiftObjectWrapper() override { + if (auto* state = Caches::StateFor(isolate_)) { + auto it = state->identity.find(object_); + if (it != state->identity.end() && it->second == this) { + state->identity.erase(it); + } + } + module_->release(object_); + } + + const WrapperType Type() override { return WrapperType::SwiftObject; } + + Local JSObject() const { return TrackedObject(isolate_); } + const ModuleInfo* Module() const { return module_; } + void* Object() const { return object_; } + uint32_t TypeIndex() const { return typeIndex_; } + + private: + Isolate* isolate_; + const ModuleInfo* module_; + void* object_; + uint32_t typeIndex_; +}; + +SwiftObjectWrapper* SwiftWrapperOf(Isolate* isolate, Local value) { + if (value.IsEmpty() || !value->IsObject()) { + return nullptr; + } + BaseDataWrapper* wrapper = tns::GetValue(isolate, value); + if (wrapper == nullptr || wrapper->Type() != WrapperType::SwiftObject) { + return nullptr; + } + return static_cast(wrapper); +} + +// --- Calls ----------------------------------------------------------------------- + +// An array, map or tagged enum case a thunk is reporting value by value. +struct ResultFrame { + bool isMap = false; + Local target; + uint32_t next = 0; + // Maps alternate key and value reports. + bool expectKey = true; + Local key; + const ValueCode* element = nullptr; + // Set for a case: its values' keys and codes. + const CaseInfo* tagged = nullptr; + // An inout argument's reference object, whose `value` receives the one + // value reported (of code `element`). + bool writeBack = false; +}; + +struct SlotArena; + +struct CallContext : NSSwiftCall { + Isolate* isolate = nullptr; + Local context; + const ModuleInfo* module = nullptr; + LoadedModule* loaded = nullptr; + IsolateState* state = nullptr; + const MemberInfo* member = nullptr; + // The object `new` created, adopted by the initializer's result. + Local constructTarget; + // Code of the call's result; open frames take precedence. + const ValueCode* resultCode = nullptr; + std::vector frames; + Local result; + bool completed = false; + bool threw = false; + // The first exception a JS callback threw while the thunk ran; it is + // thrown from the call once the thunk returns. + Global callbackException; + // The arguments' storage, including inout arguments' reference objects. + const SlotArena* arena = nullptr; +}; + +CallContext* ContextOf(NSSwiftCall* call) { return static_cast(call); } + +// The code of the value the thunk reports next. +const ValueCode* CurrentCode(CallContext* context) { + if (context->frames.empty()) { + return context->resultCode; + } + const ResultFrame& frame = context->frames.back(); + if (frame.writeBack) { + return frame.element; + } + if (frame.tagged != nullptr) { + return frame.next < frame.tagged->codes.size() ? &frame.tagged->codes[frame.next] : nullptr; + } + return frame.isMap && frame.expectKey ? &KeyCode() : frame.element; +} + +void Fail(CallContext* context) { + context->completed = true; + context->threw = true; +} + +void Complete(CallContext* context, Local value) { + if (context->frames.empty()) { + context->completed = true; + context->result = value; + return; + } + ResultFrame& frame = context->frames.back(); + bool stored = true; + if (frame.writeBack) { + stored = frame.target->Set(context->context, tns::ToV8String(context->isolate, "value"), value) + .FromMaybe(false); + } else if (frame.tagged != nullptr) { + stored = frame.next < frame.tagged->keys.size() && + frame.target + ->Set(context->context, + tns::ToV8String(context->isolate, frame.tagged->keys[frame.next++]), value) + .FromMaybe(false); + } else if (!frame.isMap) { + stored = frame.target->Set(context->context, frame.next++, value).FromMaybe(false); + } else if (frame.expectKey) { + frame.key = value; + frame.expectKey = false; + } else { + stored = frame.target->Set(context->context, frame.key, value).FromMaybe(false); + frame.expectKey = true; + } + if (!stored) { + Fail(context); + } +} + +std::string RangeMessage(const std::string& value, const std::string& swiftName) { + return value + " returned by " + swiftName + + " is outside the range JavaScript numbers represent exactly"; +} + +void ThrowRange(CallContext* context, const std::string& what) { + Fail(context); + context->isolate->ThrowException(Exception::RangeError( + tns::ToV8String(context->isolate, RangeMessage(what, context->member->swiftName)))); +} + +// NativeScript's wrapper of `object`, taking over a +1 reference to it. +MaybeLocal WrapObjC(Isolate* isolate, Local context, id object) { + if (object == nil) { + return v8::Null(isolate); + } + Local result; + auto cached = ArgConverter::FindCachedInstance(isolate, Caches::Get(isolate), object); + if (cached != nullptr) { + result = cached->Get(isolate); + } else { + ObjCDataWrapper* wrapper = new ObjCDataWrapper(object); + result = ArgConverter::ConvertArgument(context, wrapper); + tns::DeleteWrapperIfUnused(isolate, result, wrapper); + } + [object release]; + return result.IsEmpty() ? MaybeLocal() : MaybeLocal(result); +} + +// The Objective-C object a NativeScript wrapper holds, or nil. +id ObjCObjectOf(Isolate* isolate, Local value) { + if (!value->IsObject()) { + return nil; + } + BaseDataWrapper* wrapper = tns::GetValue(isolate, value); + return wrapper != nullptr && wrapper->Type() == WrapperType::ObjCObject + ? static_cast(wrapper)->Data() + : nil; +} + +bool IsObjCInstance(id object, const ValueCode& code) { + return object != nil && (code.objcClass == nil || [object isKindOfClass:code.objcClass]); +} + +void ApiReturnObjC(NSSwiftCall* call, void* object) { + CallContext* context = ContextOf(call); + Local value; + if (!WrapObjC(context->isolate, context->context, static_cast(object)).ToLocal(&value)) { + return Fail(context); + } + Complete(context, value); +} + +// A Uint8Array holding a copy of `bytes`. +MaybeLocal MakeBytes(Isolate* isolate, const uint8_t* bytes, size_t length) { + Local buffer = v8::ArrayBuffer::New(isolate, length); + if (length > 0) { + memcpy(buffer->Data(), bytes, length); + } + return v8::Uint8Array::New(buffer, 0, length); +} + +// `new URL(href)` with the realm's URL. +MaybeLocal MakeURL(Isolate* isolate, Local context, Local href) { + Local constructor; + if (!context->Global()->Get(context, tns::ToV8String(isolate, "URL")).ToLocal(&constructor) || + !constructor->IsFunction()) { + return href; + } + Local argv[] = {href}; + Local url; + if (!constructor.As()->NewInstance(context, 1, argv).ToLocal(&url)) { + return MaybeLocal(); + } + return url; +} + +void ApiReturnVoid(NSSwiftCall* call) { + CallContext* context = ContextOf(call); + Complete(context, v8::Undefined(context->isolate)); +} + +void ApiReturnBool(NSSwiftCall* call, uint8_t value) { + CallContext* context = ContextOf(call); + Complete(context, v8::Boolean::New(context->isolate, value != 0)); +} + +void ApiReturnInt64(NSSwiftCall* call, int64_t value) { + CallContext* context = ContextOf(call); + if (std::fabs(static_cast(value)) > kMaxSafeInteger) { + return ThrowRange(context, std::to_string(value)); + } + Complete(context, v8::Number::New(context->isolate, static_cast(value))); +} + +void ApiReturnUInt64(NSSwiftCall* call, uint64_t value) { + CallContext* context = ContextOf(call); + if (static_cast(value) > kMaxSafeInteger) { + return ThrowRange(context, std::to_string(value)); + } + Complete(context, v8::Number::New(context->isolate, static_cast(value))); +} + +void ApiReturnDouble(NSSwiftCall* call, double value) { + CallContext* context = ContextOf(call); + const ValueCode* code = CurrentCode(context); + if (code && code->kind == ValueCode::Kind::Date) { + Local date; + if (!v8::Date::New(context->context, value).ToLocal(&date)) { + return Fail(context); + } + return Complete(context, date); + } + Complete(context, v8::Number::New(context->isolate, value)); +} + +void ApiReturnString(NSSwiftCall* call, const uint8_t* utf8, intptr_t length) { + CallContext* context = ContextOf(call); + const ValueCode* code = CurrentCode(context); + if (code && code->kind == ValueCode::Kind::Data) { + Local bytes; + if (!MakeBytes(context->isolate, utf8, static_cast(length)).ToLocal(&bytes)) { + return Fail(context); + } + return Complete(context, bytes); + } + Local string; + if (!v8::String::NewFromUtf8(context->isolate, + reinterpret_cast(utf8 ? utf8 : (const uint8_t*)""), + v8::NewStringType::kNormal, static_cast(length)) + .ToLocal(&string)) { + return Fail(context); + } + if (code && code->kind == ValueCode::Kind::URL) { + Local url; + if (!MakeURL(context->isolate, context->context, string).ToLocal(&url)) { + return Fail(context); + } + return Complete(context, url); + } + Complete(context, string); +} + +void ApiReturnNull(NSSwiftCall* call) { + CallContext* context = ContextOf(call); + Complete(context, v8::Null(context->isolate)); +} + +void BeginContainer(CallContext* context, bool isMap, intptr_t count) { + const ValueCode* code = CurrentCode(context); + ValueCode::Kind expected = isMap ? ValueCode::Kind::Map : ValueCode::Kind::Array; + if (code == nullptr || code->kind != expected || code->element.empty()) { + Fail(context); + context->isolate->ThrowException(Exception::Error(tns::ToV8String( + context->isolate, context->member->swiftName + " reported an unexpected collection"))); + return; + } + ResultFrame frame; + frame.isMap = isMap; + frame.target = isMap ? Local(Object::New(context->isolate)) + : Local(v8::Array::New(context->isolate, static_cast(count))); + frame.element = &code->element[0]; + context->frames.push_back(frame); +} + +void EndContainer(CallContext* context) { + if (context->frames.empty()) { + return Fail(context); + } + Local target = context->frames.back().target; + context->frames.pop_back(); + Complete(context, target); +} + +void ApiReturnArrayBegin(NSSwiftCall* call, intptr_t count) { + BeginContainer(ContextOf(call), false, count); +} + +void ApiReturnArrayEnd(NSSwiftCall* call) { EndContainer(ContextOf(call)); } + +void ApiReturnMapBegin(NSSwiftCall* call, intptr_t count) { + BeginContainer(ContextOf(call), true, count); +} + +void ApiReturnMapEnd(NSSwiftCall* call) { EndContainer(ContextOf(call)); } + +// `{ case: name }`, filled in by the case's values. +MaybeLocal NewCaseObject(Isolate* isolate, Local context, const CaseInfo& info) { + Local object = Object::New(isolate); + if (!object->Set(context, tns::ToV8String(isolate, "case"), tns::ToV8String(isolate, info.name)) + .FromMaybe(false)) { + return MaybeLocal(); + } + return object; +} + +// The case `caseIndex` of the tagged enum `code` names, or null. +const CaseInfo* CaseOf(const ModuleInfo& module, const ValueCode* code, intptr_t caseIndex) { + if (code == nullptr || code->kind != ValueCode::Kind::Tagged || code->typeIndex < 0 || + code->typeIndex >= static_cast(module.types.size())) { + return nullptr; + } + const auto& cases = module.types[code->typeIndex].cases; + return caseIndex >= 0 && caseIndex < static_cast(cases.size()) ? &cases[caseIndex] + : nullptr; +} + +Local ReferenceAt(const SlotArena* arena, intptr_t index); + +void ApiWriteBackBegin(NSSwiftCall* call, intptr_t index) { + CallContext* context = ContextOf(call); + const auto& parameters = context->member->signature.parameters; + Local reference; + if (index >= 0 && index < static_cast(parameters.size()) && parameters[index].inout) { + reference = ReferenceAt(context->arena, index); + } + if (reference.IsEmpty()) { + Fail(context); + context->isolate->ThrowException(Exception::Error(tns::ToV8String( + context->isolate, context->member->swiftName + " reported an unexpected inout value"))); + return; + } + ResultFrame frame; + frame.target = reference; + frame.element = ¶meters[index]; + frame.writeBack = true; + context->frames.push_back(frame); +} + +void ApiWriteBackEnd(NSSwiftCall* call) { + CallContext* context = ContextOf(call); + if (context->frames.empty() || !context->frames.back().writeBack) { + return Fail(context); + } + context->frames.pop_back(); +} + +void ApiReturnCaseBegin(NSSwiftCall* call, intptr_t caseIndex) { + CallContext* context = ContextOf(call); + const CaseInfo* info = CaseOf(*context->module, CurrentCode(context), caseIndex); + ResultFrame frame; + if (info == nullptr || + !NewCaseObject(context->isolate, context->context, *info).ToLocal(&frame.target)) { + Fail(context); + context->isolate->ThrowException(Exception::Error(tns::ToV8String( + context->isolate, context->member->swiftName + " reported an unexpected enum case"))); + return; + } + frame.tagged = info; + context->frames.push_back(frame); +} + +// The JS wrapper for `object`, taking over the +1 retain the thunk passed. +// Adopts `*constructTarget` (the object `new` created) when it is set. +Local WrapSwiftObject(Isolate* isolate, Local context, const ModuleInfo* module, + LoadedModule* loaded, IsolateState* state, void* object, + uint32_t typeIndex, Local* constructTarget) { + auto existing = state->identity.find(object); + if (existing != state->identity.end()) { + Local wrapper = existing->second->JSObject(); + if (!wrapper.IsEmpty()) { + // The thunk handed over a retain the existing wrapper already holds. + module->release(object); + return wrapper; + } + } + + Local instance; + if (constructTarget && !constructTarget->IsEmpty()) { + instance = *constructTarget; + constructTarget->Clear(); + } else { + if (loaded == nullptr || typeIndex >= loaded->templates.size() || + loaded->templates[typeIndex].IsEmpty()) { + module->release(object); + return Local(); + } + Local tmpl = loaded->templates[typeIndex].Get(isolate); + if (!tmpl->InstanceTemplate()->NewInstance(context).ToLocal(&instance)) { + module->release(object); + return Local(); + } + } + + auto* wrapper = new SwiftObjectWrapper(isolate, module, object, typeIndex); + tns::SetValue(isolate, instance, wrapper); + wrapper->BindFinalizer(isolate, instance); + state->identity[object] = wrapper; + return instance; +} + +Local WrapObject(CallContext* context, void* object, uint32_t typeIndex) { + return WrapSwiftObject(context->isolate, context->context, context->module, context->loaded, + context->state, object, typeIndex, &context->constructTarget); +} + +// A Swift error as a JS Error: name "SwiftError" and the error's type in +// `swiftType` (a plain Error when there is no type). +Local SwiftErrorValue(Isolate* isolate, Local context, const std::string& message, + const std::string& typeName) { + Local error = Exception::Error(tns::ToV8String(isolate, message)); + if (!typeName.empty() && error->IsObject()) { + Local object = error.As(); + object->Set(context, tns::ToV8String(isolate, "name"), tns::ToV8String(isolate, "SwiftError")) + .Check(); + object->Set(context, tns::ToV8String(isolate, "swiftType"), tns::ToV8String(isolate, typeName)) + .Check(); + } + return error; +} + +void ApiReturnObject(NSSwiftCall* call, void* object, uint32_t typeIndex) { + CallContext* context = ContextOf(call); + if (object == nullptr || typeIndex >= context->module->types.size()) { + context->completed = true; + context->threw = true; + context->isolate->ThrowException( + Exception::Error(tns::ToV8String(context->isolate, "Swift returned an invalid object"))); + return; + } + Local wrapper = WrapObject(context, object, typeIndex); + if (wrapper.IsEmpty()) { + context->completed = true; + context->threw = true; + return; + } + Complete(context, wrapper); +} + +void ApiThrowError(NSSwiftCall* call, const uint8_t* message, intptr_t messageLength, + const uint8_t* type, intptr_t typeLength) { + CallContext* context = ContextOf(call); + context->completed = true; + context->threw = true; + std::string text(reinterpret_cast(message), message ? messageLength : 0); + std::string typeName(reinterpret_cast(type), type ? typeLength : 0); + context->isolate->ThrowException( + SwiftErrorValue(context->isolate, context->context, text, typeName)); +} + +void ApiThrowTypeError(NSSwiftCall* call, const uint8_t* message, intptr_t length) { + CallContext* context = ContextOf(call); + context->completed = true; + context->threw = true; + std::string text(reinterpret_cast(message), message ? length : 0); + context->isolate->ThrowException(Exception::TypeError( + tns::ToV8String(context->isolate, context->member->swiftName + ": " + text))); +} + +// --- Async calls ------------------------------------------------------------------- +// +// beginAsync runs on the isolate's thread inside the call; complete* runs on +// whatever thread the Swift task finishes on. Neither the token nor the +// outcome holds V8 handles, so either may be destroyed on any thread. + +// What a Swift task produced, in a form that can cross threads. Arrays and +// maps hold their elements (a map's alternate key and value) as children, a +// tagged enum case its values (with its case index in `int64`). +struct AsyncOutcome { + enum class Kind { + Void, + Bool, + Int64, + UInt64, + Double, + String, + Null, + Object, + Error, + Array, + Map, + Case, + ObjC, + }; + Kind kind = Kind::Void; + bool boolean = false; + int64_t int64 = 0; + uint64_t uint64 = 0; + double float64 = 0; + std::string text; + std::string errorType; + void* object = nullptr; + uint32_t typeIndex = 0; + const ModuleInfo* module = nullptr; + std::vector> children; + + // An undelivered object (the isolate went away) still owns its retain. + ~AsyncOutcome() { + if (object != nullptr) { + module->release(object); + } + } +}; + +struct AsyncToken { + Isolate* isolate; + IsolateWrapper wrapper; + uint64_t id; + const ModuleInfo* module; + std::shared_ptr root; + // Arrays and maps still being reported. + std::vector open; + // Set for a callback invocation; the token holds a reference. + struct SwiftCallback* callback = nullptr; +}; + +// Converts `node` (of `code`) to JS; on failure sets `rejection` and returns +// false. +bool OutcomeToJS(Isolate* isolate, Local context, IsolateState* state, + const std::string& name, AsyncOutcome& node, const ValueCode& code, + Local& out, Local& rejection) { + auto range = [&](const std::string& value) { + rejection = Exception::RangeError(tns::ToV8String(isolate, RangeMessage(value, name))); + return false; + }; + auto failed = [&](const char* what) { + rejection = Exception::Error(tns::ToV8String(isolate, name + ": " + what)); + return false; + }; + switch (node.kind) { + case AsyncOutcome::Kind::Void: + out = v8::Undefined(isolate); + return true; + case AsyncOutcome::Kind::Bool: + out = v8::Boolean::New(isolate, node.boolean); + return true; + case AsyncOutcome::Kind::Int64: + if (std::fabs(static_cast(node.int64)) > kMaxSafeInteger) { + return range(std::to_string(node.int64)); + } + out = v8::Number::New(isolate, static_cast(node.int64)); + return true; + case AsyncOutcome::Kind::UInt64: + if (static_cast(node.uint64) > kMaxSafeInteger) { + return range(std::to_string(node.uint64)); + } + out = v8::Number::New(isolate, static_cast(node.uint64)); + return true; + case AsyncOutcome::Kind::Double: + if (code.kind == ValueCode::Kind::Date) { + return v8::Date::New(context, node.float64).ToLocal(&out) || failed("invalid date"); + } + out = v8::Number::New(isolate, node.float64); + return true; + case AsyncOutcome::Kind::String: { + if (code.kind == ValueCode::Kind::Data) { + return MakeBytes(isolate, reinterpret_cast(node.text.data()), + node.text.size()) + .ToLocal(&out) || + failed("could not copy data"); + } + Local string = tns::ToV8String(isolate, node.text); + if (code.kind == ValueCode::Kind::URL) { + return MakeURL(isolate, context, string).ToLocal(&out) || failed("invalid URL"); + } + out = string; + return true; + } + case AsyncOutcome::Kind::Null: + out = v8::Null(isolate); + return true; + case AsyncOutcome::Kind::Object: { + auto loaded = state->byInfo.find(node.module); + void* object = node.object; + // WrapSwiftObject takes over the retain. + node.object = nullptr; + Local wrapper = WrapSwiftObject( + isolate, context, node.module, loaded == state->byInfo.end() ? nullptr : loaded->second, + state, object, node.typeIndex, nullptr); + if (wrapper.IsEmpty()) { + return failed("returned an object JavaScript cannot wrap"); + } + out = wrapper; + return true; + } + case AsyncOutcome::Kind::ObjC: { + id object = static_cast(node.object); + node.object = nullptr; + return WrapObjC(isolate, context, object).ToLocal(&out) || + failed("returned an object JavaScript cannot wrap"); + } + case AsyncOutcome::Kind::Array: { + if (code.element.empty()) { + return failed("returned an unexpected array"); + } + Local array = v8::Array::New(isolate, static_cast(node.children.size())); + for (uint32_t i = 0; i < node.children.size(); i++) { + Local element; + if (!OutcomeToJS(isolate, context, state, name, *node.children[i], code.element[0], element, + rejection) || + !array->Set(context, i, element).FromMaybe(false)) { + return false; + } + } + out = array; + return true; + } + case AsyncOutcome::Kind::Map: { + if (code.element.empty()) { + return failed("returned an unexpected map"); + } + Local object = Object::New(isolate); + for (size_t i = 0; i + 1 < node.children.size(); i += 2) { + Local key; + Local value; + if (!OutcomeToJS(isolate, context, state, name, *node.children[i], KeyCode(), key, + rejection) || + !OutcomeToJS(isolate, context, state, name, *node.children[i + 1], code.element[0], + value, rejection) || + !object->Set(context, key, value).FromMaybe(false)) { + return false; + } + } + out = object; + return true; + } + case AsyncOutcome::Kind::Case: { + const CaseInfo* info = CaseOf(*node.module, &code, node.int64); + Local object; + if (info == nullptr || node.children.size() != info->codes.size() || + !NewCaseObject(isolate, context, *info).ToLocal(&object)) { + return failed("returned an unexpected enum case"); + } + for (size_t i = 0; i < node.children.size(); i++) { + Local value; + if (!OutcomeToJS(isolate, context, state, name, *node.children[i], info->codes[i], value, + rejection) || + !object->Set(context, tns::ToV8String(isolate, info->keys[i]), value) + .FromMaybe(false)) { + return false; + } + } + out = object; + return true; + } + case AsyncOutcome::Kind::Error: + rejection = SwiftErrorValue(isolate, context, node.text, node.errorType); + return false; + } + return failed("returned an unknown value"); +} + +void SettleOnIsolate(Isolate* isolate, uint64_t id, AsyncOutcome& outcome) { + auto* state = Caches::StateFor(isolate); + if (state == nullptr) { + return; + } + auto it = state->pending.find(id); + if (it == state->pending.end()) { + return; + } + std::unique_ptr pending = std::move(it->second); + state->pending.erase(it); + + Local context = isolate->GetCurrentContext(); + Local resolver = pending->resolver.Get(isolate); + Local value; + Local rejection; + if (OutcomeToJS(isolate, context, state, pending->member->swiftName, outcome, + pending->member->signature.result, value, rejection)) { + resolver->Resolve(context, value).Check(); + } else { + resolver->Reject(context, rejection).Check(); + } +} + +// --- Callbacks --------------------------------------------------------------------- + +// A JS function passed for a closure parameter. The call's arena holds one +// reference, each Swift closure capturing it another, and each invocation in +// flight one more. `function` is only touched on the isolate's thread. +struct SwiftCallback { + SwiftCallback(Isolate* isolate, const ModuleInfo* module, const ValueCode& code, + const std::string& name, Local function) + : isolate(isolate), + wrapper(isolate), + module(module), + code(code), + name(name), + function(isolate, function) {} + + Isolate* isolate; + IsolateWrapper wrapper; + const ModuleInfo* module; + ValueCode code; + std::string name; + Global function; + std::atomic references{1}; +}; + +// Runs `body` on the isolate's thread with the isolate locked and valid: +// now when called there, otherwise queued. Returns false when it will not run. +bool OnIsolateThread(Isolate* isolate, IsolateWrapper wrapper, std::function body) { + if (Isolate::TryGetCurrent() == isolate) { + v8::Locker locker(isolate); + if (!wrapper.IsValid()) { + return false; + } + body(); + return true; + } + NativeScriptPlatform* platform = NativeScriptPlatform::Instance(); + std::shared_ptr loop = + platform ? platform->LookupEventLoop(isolate) : std::shared_ptr(); + return loop && loop->PostInternal([wrapper, body = std::move(body)]() { + if (wrapper.IsValid()) { + body(); + } + }); +} + +void ReleaseCallback(SwiftCallback* callback) { + if (callback->references.fetch_sub(1, std::memory_order_acq_rel) != 1) { + return; + } + // When it cannot run (the isolate is gone) the callback is leaked: its + // handle can no longer be reset. + OnIsolateThread(callback->isolate, callback->wrapper, [callback]() { delete callback; }); +} + +void RunCallback(SwiftCallback* callback, AsyncOutcome& arguments) { + Isolate* isolate = callback->isolate; + Isolate::Scope isolateScope(isolate); + HandleScope handleScope(isolate); + auto* state = Caches::StateFor(isolate); + if (state == nullptr) { + return; + } + Local context = Caches::Get(isolate)->GetContext(); + Context::Scope contextScope(context); + + // On the isolate's thread the innermost call in progress is the one whose + // thunk invoked the closure; after its callback threw, the rest are + // skipped. + CallContext* call = state->calls.empty() ? nullptr : state->calls.back(); + if (call != nullptr && !call->callbackException.IsEmpty()) { + return; + } + + TryCatch tryCatch(isolate); + Local exception; + const std::vector& parameters = callback->code.element; + std::vector> argv; + if (arguments.children.size() != parameters.size()) { + exception = Exception::Error( + tns::ToV8String(isolate, callback->name + ": a closure reported " + + std::to_string(arguments.children.size()) + + " arguments, expected " + std::to_string(parameters.size()))); + } + for (size_t i = 0; exception.IsEmpty() && i < parameters.size(); i++) { + Local value; + if (!OutcomeToJS(isolate, context, state, callback->name, *arguments.children[i], parameters[i], + value, exception)) { + break; + } + argv.push_back(value); + } + if (exception.IsEmpty()) { + Local ignored; + if (callback->function.Get(isolate) + ->Call(context, v8::Undefined(isolate), static_cast(argv.size()), argv.data()) + .ToLocal(&ignored) || + !tryCatch.HasCaught() || !tryCatch.CanContinue()) { + return; + } + exception = tryCatch.Exception(); + } + if (call != nullptr) { + call->callbackException.Reset(isolate, exception); + } else { + NativeScriptException::ReportToJsHandlersAndLog(isolate, exception, tryCatch.Message()); + } +} + +void DeliverCallback(std::unique_ptr token) { + SwiftCallback* callback = token->callback; + std::shared_ptr arguments = token->root; + bool scheduled = OnIsolateThread(callback->isolate, callback->wrapper, [callback, arguments]() { + RunCallback(callback, *arguments); + ReleaseCallback(callback); + }); + if (!scheduled) { + ReleaseCallback(callback); + } +} + +// Consumes `token`. Safe on any thread. +void Deliver(AsyncToken* rawToken) { + std::unique_ptr token(rawToken); + if (token->callback != nullptr) { + return DeliverCallback(std::move(token)); + } + std::shared_ptr outcome = token->root; + NativeScriptPlatform* platform = NativeScriptPlatform::Instance(); + std::shared_ptr loop = + platform ? platform->LookupEventLoop(token->isolate) : std::shared_ptr(); + if (!loop || !outcome) { + return; + } + Isolate* isolate = token->isolate; + IsolateWrapper wrapper = token->wrapper; + uint64_t id = token->id; + // The event loop enters the isolate and drains microtasks around this; a + // dropped post releases the outcome (and its objects) here. + loop->PostInternal([isolate, wrapper, id, outcome]() { + if (!wrapper.IsValid()) { + return; + } + SettleOnIsolate(isolate, id, *outcome); + }); +} + +// Records one reported value; delivers once the top-level value is complete. +void Emit(void* rawToken, std::shared_ptr node) { + auto* token = static_cast(rawToken); + node->module = token->module; + bool opens = node->kind == AsyncOutcome::Kind::Array || node->kind == AsyncOutcome::Kind::Map || + node->kind == AsyncOutcome::Kind::Case; + AsyncOutcome* raw = node.get(); + if (token->open.empty()) { + token->root = std::move(node); + } else { + token->open.back()->children.push_back(std::move(node)); + } + if (opens) { + token->open.push_back(raw); + } else if (token->open.empty()) { + Deliver(token); + } +} + +std::shared_ptr Outcome(AsyncOutcome::Kind kind) { + auto outcome = std::make_shared(); + outcome->kind = kind; + return outcome; +} + +void* ApiBeginAsync(NSSwiftCall* call) { + CallContext* context = ContextOf(call); + Isolate* isolate = context->isolate; + uint64_t id = context->state->nextAsyncId++; + Local resolver; + if (Promise::Resolver::New(context->context).ToLocal(&resolver)) { + auto pending = std::make_unique(); + pending->resolver.Reset(isolate, resolver); + pending->member = context->member; + context->state->pending.emplace(id, std::move(pending)); + Complete(context, resolver->GetPromise()); + } else { + // The token is still completed later; it then finds no pending entry. + Fail(context); + } + return new AsyncToken{isolate, IsolateWrapper(isolate), id, context->module, nullptr, {}}; +} + +void* ApiCallbackBegin(void* rawCallback) { + auto* callback = static_cast(rawCallback); + callback->references.fetch_add(1, std::memory_order_relaxed); + auto* token = new AsyncToken{callback->isolate, + callback->wrapper, + 0, + callback->module, + Outcome(AsyncOutcome::Kind::Array), + {}}; + token->root->module = callback->module; + token->open.push_back(token->root.get()); + token->callback = callback; + return token; +} + +void ApiCallbackRetain(void* callback) { + static_cast(callback)->references.fetch_add(1, std::memory_order_relaxed); +} + +void ApiCallbackRelease(void* callback) { ReleaseCallback(static_cast(callback)); } + +void ApiCompleteVoid(void* token) { Emit(token, Outcome(AsyncOutcome::Kind::Void)); } + +void ApiCompleteBool(void* token, uint8_t value) { + auto outcome = Outcome(AsyncOutcome::Kind::Bool); + outcome->boolean = value != 0; + Emit(token, outcome); +} + +void ApiCompleteInt64(void* token, int64_t value) { + auto outcome = Outcome(AsyncOutcome::Kind::Int64); + outcome->int64 = value; + Emit(token, outcome); +} + +void ApiCompleteUInt64(void* token, uint64_t value) { + auto outcome = Outcome(AsyncOutcome::Kind::UInt64); + outcome->uint64 = value; + Emit(token, outcome); +} + +void ApiCompleteDouble(void* token, double value) { + auto outcome = Outcome(AsyncOutcome::Kind::Double); + outcome->float64 = value; + Emit(token, outcome); +} + +void ApiCompleteString(void* token, const uint8_t* utf8, intptr_t length) { + auto outcome = Outcome(AsyncOutcome::Kind::String); + outcome->text.assign(reinterpret_cast(utf8), utf8 ? length : 0); + Emit(token, outcome); +} + +void ApiCompleteNull(void* token) { Emit(token, Outcome(AsyncOutcome::Kind::Null)); } + +void ApiCompleteObject(void* token, void* object, uint32_t typeIndex) { + auto outcome = Outcome(AsyncOutcome::Kind::Object); + outcome->object = object; + outcome->typeIndex = typeIndex; + Emit(token, outcome); +} + +void ApiCompleteError(void* token, const uint8_t* message, intptr_t messageLength, + const uint8_t* type, intptr_t typeLength) { + auto outcome = Outcome(AsyncOutcome::Kind::Error); + outcome->text.assign(reinterpret_cast(message), message ? messageLength : 0); + outcome->errorType.assign(reinterpret_cast(type), type ? typeLength : 0); + Emit(token, outcome); +} + +void ApiCompleteArrayBegin(void* token, intptr_t /*count*/) { + Emit(token, Outcome(AsyncOutcome::Kind::Array)); +} + +void ApiCompleteMapBegin(void* token, intptr_t /*count*/) { + Emit(token, Outcome(AsyncOutcome::Kind::Map)); +} + +void ApiCompleteObjC(void* token, void* object) { + auto outcome = Outcome(AsyncOutcome::Kind::ObjC); + outcome->object = object; + Emit(token, outcome); +} + +void ApiCompleteCaseBegin(void* token, intptr_t caseIndex) { + auto outcome = Outcome(AsyncOutcome::Kind::Case); + outcome->int64 = caseIndex; + Emit(token, outcome); +} + +void ApiCompleteContainerEnd(void* rawToken) { + auto* token = static_cast(rawToken); + if (!token->open.empty()) { + token->open.pop_back(); + } + if (token->open.empty()) { + Deliver(token); + } +} + +// --- Argument conversion ----------------------------------------------------------- + +bool IsPlainObject(Isolate* isolate, Local value) { + return value->IsObject() && !value->IsArray() && !value->IsFunction() && + SwiftWrapperOf(isolate, value) == nullptr; +} + +// An object JS code builds as a record: maps and tagged enum cases. +bool IsRecord(Isolate* isolate, Local value) { + return IsPlainObject(isolate, value) && !value->IsDate() && !value->IsArrayBuffer() && + !value->IsArrayBufferView(); +} + +// Whether `value` can be passed as `code` (overload resolution; no throws, no +// user code). Collections are checked by kind only; Convert checks elements. +bool Accepts(Isolate* isolate, const ModuleInfo& module, const ValueCode& code, + Local value) { + if (code.inout) { + return IsRecord(isolate, value); + } + if (value->IsNullOrUndefined()) { + return code.optional; + } + switch (code.kind) { + case ValueCode::Kind::Bool: + return value->IsBoolean(); + case ValueCode::Kind::Signed: + case ValueCode::Kind::Unsigned: + if (value->IsBigInt()) { + return true; + } + if (value->IsNumber()) { + double number = value.As()->Value(); + return std::isfinite(number) && std::trunc(number) == number; + } + return false; + case ValueCode::Kind::Float: + return value->IsNumber(); + case ValueCode::Kind::String: + case ValueCode::Kind::Enum: + return value->IsString(); + case ValueCode::Kind::URL: + return value->IsString() || + (value->IsObject() && !value->IsArray() && SwiftWrapperOf(isolate, value) == nullptr); + case ValueCode::Kind::Date: + return value->IsDate(); + case ValueCode::Kind::Data: + return value->IsArrayBuffer() || value->IsArrayBufferView(); + case ValueCode::Kind::Array: + return value->IsArray(); + case ValueCode::Kind::Map: + case ValueCode::Kind::Tagged: + return IsRecord(isolate, value); + case ValueCode::Kind::Object: { + SwiftObjectWrapper* wrapper = SwiftWrapperOf(isolate, value); + return wrapper && wrapper->Module() == &module && + module.IsA(wrapper->TypeIndex(), code.typeIndex); + } + case ValueCode::Kind::Function: + return value->IsFunction(); + case ValueCode::Kind::ObjC: + return IsObjCInstance(ObjCObjectOf(isolate, value), code); + case ValueCode::Kind::Void: + return false; + } + return false; +} + +bool ThrowArgument(Isolate* isolate, const MemberInfo& member, size_t index, + const std::string& problem, bool range = false) { + std::string message = + member.swiftName + ": argument " + std::to_string(index + 1) + " " + problem; + Local text = tns::ToV8String(isolate, message); + isolate->ThrowException(range ? Exception::RangeError(text) : Exception::TypeError(text)); + return false; +} + +// Storage the slots of one call point into. Deques keep every buffer at a +// fixed address while more are added. +struct SlotArena { + std::deque strings; + std::deque> slots; + std::vector callbacks; + // By parameter index; empty except for inout arguments. + std::vector> references; + + SlotArena() = default; + SlotArena(const SlotArena&) = delete; + SlotArena& operator=(const SlotArena&) = delete; + ~SlotArena() { + for (SwiftCallback* callback : callbacks) { + ReleaseCallback(callback); + } + } +}; + +Local ReferenceAt(const SlotArena* arena, intptr_t index) { + return arena != nullptr && index < static_cast(arena->references.size()) + ? arena->references[index] + : Local(); +} + +void PointAtBytes(NSSwiftValue& slot, const void* bytes, size_t length) { + slot.tag = NSSwiftTagString; + slot.payload.utf8 = static_cast(bytes); + slot.length = length; +} + +bool WriteString(Isolate* isolate, Local string, NSSwiftValue& slot, SlotArena& arena) { + size_t length = string->Utf8LengthV2(isolate); + arena.strings.emplace_back(length, '\0'); + std::string& buffer = arena.strings.back(); + if (length > 0) { + string->WriteUtf8V2(isolate, buffer.data(), length, + v8::String::WriteFlags::kReplaceInvalidUtf8); + } + PointAtBytes(slot, buffer.data(), length); + return true; +} + +// Writes `value` into `slot`; `index` names the argument in errors. +bool Convert(Isolate* isolate, Local context, const ModuleInfo& module, + const MemberInfo& member, size_t index, const ValueCode& code, Local value, + NSSwiftValue& slot, SlotArena& arena) { + slot = NSSwiftValue{}; + if (code.inout) { + ValueCode inner = code; + inner.inout = false; + if (!IsRecord(isolate, value)) { + return ThrowArgument( + isolate, member, index, + "is inout: pass a reference object, { value: " + TypeDisplayName(module, inner) + " }"); + } + Local current; + if (!value.As()->Get(context, tns::ToV8String(isolate, "value")).ToLocal(¤t)) { + return false; + } + if (arena.references.size() <= index) { + arena.references.resize(index + 1); + } + arena.references[index] = value.As(); + return Convert(isolate, context, module, member, index, inner, current, slot, arena); + } + if (value->IsNullOrUndefined()) { + if (!code.optional) { + return ThrowArgument(isolate, member, index, + "must be " + TypeDisplayName(module, code) + ", not " + + (value->IsNull() ? "null" : "undefined")); + } + slot.tag = NSSwiftTagNull; + return true; + } + + switch (code.kind) { + case ValueCode::Kind::Bool: + if (!value->IsBoolean()) { + return ThrowArgument(isolate, member, index, "must be a boolean"); + } + slot.tag = NSSwiftTagBool; + slot.payload.boolean = value->BooleanValue(isolate) ? 1 : 0; + return true; + + case ValueCode::Kind::Signed: { + int64_t result = 0; + if (value->IsBigInt()) { + bool lossless = false; + result = value.As()->Int64Value(&lossless); + if (!lossless) { + return ThrowArgument(isolate, member, index, "is out of range", true); + } + } else if (value->IsNumber()) { + double number = value.As()->Value(); + if (!std::isfinite(number) || std::trunc(number) != number) { + return ThrowArgument(isolate, member, index, "must be an integer"); + } + if (std::fabs(number) > kMaxSafeInteger) { + return ThrowArgument(isolate, member, index, "is not a safe integer; pass a BigInt", + true); + } + result = static_cast(number); + } else { + return ThrowArgument(isolate, member, index, "must be a number or BigInt"); + } + if (code.bits < 64) { + int64_t limit = int64_t(1) << (code.bits - 1); + if (result < -limit || result >= limit) { + return ThrowArgument(isolate, member, index, + "does not fit " + TypeDisplayName(module, code), true); + } + } + slot.tag = NSSwiftTagInt64; + slot.payload.int64 = result; + return true; + } + + case ValueCode::Kind::Unsigned: { + uint64_t result = 0; + if (value->IsBigInt()) { + bool lossless = false; + result = value.As()->Uint64Value(&lossless); + if (!lossless) { + return ThrowArgument(isolate, member, index, "is out of range", true); + } + } else if (value->IsNumber()) { + double number = value.As()->Value(); + if (!std::isfinite(number) || std::trunc(number) != number) { + return ThrowArgument(isolate, member, index, "must be an integer"); + } + if (number < 0 || number > kMaxSafeInteger) { + return ThrowArgument( + isolate, member, index, + number < 0 ? "must not be negative" : "is not a safe integer; pass a BigInt", true); + } + result = static_cast(number); + } else { + return ThrowArgument(isolate, member, index, "must be a number or BigInt"); + } + if (code.bits < 64 && result >= (uint64_t(1) << code.bits)) { + return ThrowArgument(isolate, member, index, + "does not fit " + TypeDisplayName(module, code), true); + } + slot.tag = NSSwiftTagUInt64; + slot.payload.uint64 = result; + return true; + } + + case ValueCode::Kind::Float: + if (!value->IsNumber()) { + return ThrowArgument(isolate, member, index, "must be a number"); + } + slot.tag = NSSwiftTagDouble; + slot.payload.float64 = value.As()->Value(); + return true; + + case ValueCode::Kind::Date: + if (!value->IsDate()) { + return ThrowArgument(isolate, member, index, "must be a Date"); + } + slot.tag = NSSwiftTagDouble; + slot.payload.float64 = value.As()->ValueOf(); + return true; + + case ValueCode::Kind::String: + case ValueCode::Kind::Enum: + if (!value->IsString()) { + return ThrowArgument(isolate, member, index, + code.kind == ValueCode::Kind::Enum + ? "must be a " + TypeDisplayName(module, code) + " case name" + : "must be a string"); + } + return WriteString(isolate, value.As(), slot, arena); + + case ValueCode::Kind::URL: { + Local href = value; + if (!value->IsString()) { + // A URL object (or anything else with a string href). + if (!value->IsObject() || + !value.As()->Get(context, tns::ToV8String(isolate, "href")).ToLocal(&href) || + !href->IsString()) { + return ThrowArgument(isolate, member, index, "must be a URL or a string"); + } + } + return WriteString(isolate, href.As(), slot, arena); + } + + case ValueCode::Kind::Data: + if (value->IsArrayBufferView()) { + Local view = value.As(); + auto* base = static_cast(view->Buffer()->Data()); + PointAtBytes(slot, base ? base + view->ByteOffset() : nullptr, view->ByteLength()); + return true; + } + if (value->IsArrayBuffer()) { + Local buffer = value.As(); + PointAtBytes(slot, buffer->Data(), buffer->ByteLength()); + return true; + } + return ThrowArgument(isolate, member, index, "must be an ArrayBuffer or a typed array"); + + case ValueCode::Kind::Array: { + if (!value->IsArray()) { + return ThrowArgument(isolate, member, index, "must be an array"); + } + Local array = value.As(); + uint32_t length = array->Length(); + arena.slots.emplace_back(length); + std::vector& elements = arena.slots.back(); + for (uint32_t i = 0; i < length; i++) { + Local element; + if (!array->Get(context, i).ToLocal(&element) || + !Convert(isolate, context, module, member, index, code.element[0], element, elements[i], + arena)) { + return false; + } + } + slot.tag = NSSwiftTagArray; + slot.payload.object = elements.data(); + slot.length = length; + return true; + } + + case ValueCode::Kind::Map: { + if (!Accepts(isolate, module, code, value)) { + return ThrowArgument(isolate, member, index, "must be a plain object"); + } + Local object = value.As(); + Local keys; + if (!object->GetOwnPropertyNames(context).ToLocal(&keys)) { + return false; + } + uint32_t count = keys->Length(); + arena.slots.emplace_back(2 * count); + std::vector& entries = arena.slots.back(); + for (uint32_t i = 0; i < count; i++) { + Local key; + Local entry; + if (!keys->Get(context, i).ToLocal(&key)) { + return false; + } + Local name; + if (!key->ToString(context).ToLocal(&name) || !object->Get(context, key).ToLocal(&entry)) { + return false; + } + WriteString(isolate, name, entries[2 * i], arena); + if (!Convert(isolate, context, module, member, index, code.element[0], entry, + entries[2 * i + 1], arena)) { + return false; + } + } + slot.tag = NSSwiftTagMap; + slot.payload.object = entries.data(); + slot.length = count; + return true; + } + + case ValueCode::Kind::Object: { + SwiftObjectWrapper* wrapper = SwiftWrapperOf(isolate, value); + if (!wrapper || wrapper->Module() != &module || + !module.IsA(wrapper->TypeIndex(), code.typeIndex)) { + return ThrowArgument(isolate, member, index, "must be a " + TypeDisplayName(module, code)); + } + slot.tag = NSSwiftTagObject; + slot.payload.object = wrapper->Object(); + return true; + } + + case ValueCode::Kind::Tagged: { + const TypeInfo& type = module.types[code.typeIndex]; + std::string expected = "must be a case of " + type.jsName + " ({ case: \"...\" })"; + if (!IsRecord(isolate, value)) { + return ThrowArgument(isolate, member, index, expected); + } + Local name; + if (!value.As()->Get(context, tns::ToV8String(isolate, "case")).ToLocal(&name)) { + return false; + } + std::string caseName = name->IsString() ? tns::ToString(isolate, name) : ""; + size_t caseIndex = 0; + while (caseIndex < type.cases.size() && type.cases[caseIndex].name != caseName) { + caseIndex++; + } + if (caseIndex == type.cases.size()) { + return ThrowArgument(isolate, member, index, expected); + } + const CaseInfo& info = type.cases[caseIndex]; + arena.slots.emplace_back(1 + info.codes.size()); + std::vector& values = arena.slots.back(); + values[0].tag = NSSwiftTagInt64; + values[0].payload.int64 = static_cast(caseIndex); + for (size_t i = 0; i < info.codes.size(); i++) { + Local entry; + if (!value.As() + ->Get(context, tns::ToV8String(isolate, info.keys[i])) + .ToLocal(&entry) || + !Convert(isolate, context, module, member, index, info.codes[i], entry, values[1 + i], + arena)) { + return false; + } + } + slot.tag = NSSwiftTagCase; + slot.payload.object = values.data(); + slot.length = values.size(); + return true; + } + + case ValueCode::Kind::ObjC: { + id object = ObjCObjectOf(isolate, value); + if (!IsObjCInstance(object, code)) { + return ThrowArgument(isolate, member, index, "must be a " + code.className); + } + slot.tag = NSSwiftTagObjC; + slot.payload.object = object; + return true; + } + + case ValueCode::Kind::Function: { + if (!value->IsFunction()) { + return ThrowArgument(isolate, member, index, "must be a function"); + } + auto* callback = + new SwiftCallback(isolate, &module, code, member.swiftName, value.As()); + arena.callbacks.push_back(callback); + slot.tag = NSSwiftTagFunction; + slot.payload.object = callback; + return true; + } + + case ValueCode::Kind::Void: + break; + } + return ThrowArgument(isolate, member, index, "has an unsupported type"); +} + +// --- Dispatch ---------------------------------------------------------------------- + +bool IsInstanceKind(uint32_t kind) { + return kind == NSSwiftMemberInstanceMethod || kind == NSSwiftMemberInstanceProperty; +} + +struct Selection { + const MemberInfo* member = nullptr; + std::vector> arguments; +}; + +// Picks the overload of `group` that `arguments` can call. Initializers also +// accept a single `{ label: value }` object naming every argument label. +bool Select(Isolate* isolate, Local context, const MemberGroup& group, + const std::vector>& arguments, Selection& selection) { + const ModuleInfo& module = *group.module; + std::vector matches; + for (const MemberInfo* member : group.overloads) { + const auto& parameters = member->signature.parameters; + if (parameters.size() != arguments.size()) { + continue; + } + bool accepts = true; + for (size_t i = 0; accepts && i < parameters.size(); i++) { + accepts = Accepts(isolate, module, parameters[i], arguments[i]); + } + if (accepts) { + matches.push_back(member); + } + } + + if (matches.empty() && group.kind == NSSwiftMemberInitializer && arguments.size() == 1 && + IsPlainObject(isolate, arguments[0])) { + Local object = arguments[0].As(); + Local names; + if (object->GetOwnPropertyNames(context).ToLocal(&names)) { + std::set keys; + for (uint32_t i = 0; i < names->Length(); i++) { + Local name; + if (names->Get(context, i).ToLocal(&name)) { + keys.insert(tns::ToString(isolate, name)); + } + } + for (const MemberInfo* member : group.overloads) { + std::set labels(member->labels.begin(), member->labels.end()); + if (member->labels.empty() || labels.count("") || labels != keys) { + continue; + } + std::vector> ordered; + bool accepts = true; + for (size_t i = 0; accepts && i < member->labels.size(); i++) { + Local value; + accepts = + object->Get(context, tns::ToV8String(isolate, member->labels[i])).ToLocal(&value) && + Accepts(isolate, module, member->signature.parameters[i], value); + ordered.push_back(value); + } + if (accepts) { + selection.member = member; + selection.arguments = std::move(ordered); + return true; + } + } + } + } + + if (matches.size() == 1) { + selection.member = matches[0]; + selection.arguments = arguments; + return true; + } + + std::string candidates; + for (const MemberInfo* member : matches.empty() ? group.overloads : matches) { + candidates += + (candidates.empty() ? "" : ", ") + std::string("'") + TypedKey(module, *member) + "'"; + } + std::string message = + matches.empty() + ? "No overload of " + group.jsName + " accepts these arguments; candidates: " + candidates + : "Ambiguous call to " + group.jsName + "; call one of " + candidates + " by key"; + isolate->ThrowException(Exception::TypeError(tns::ToV8String(isolate, message))); + return false; +} + +LoadedModule* LoadedFor(Isolate* isolate, const ModuleInfo* module) { + auto* state = Caches::StateFor(isolate); + if (state == nullptr) { + return nullptr; + } + auto it = state->byInfo.find(module); + return it == state->byInfo.end() ? nullptr : it->second; +} + +// Calls `member`'s getter/call thunk (or its setter when `setter`) with +// `receiver` (empty for non-instance members) and `arguments`. +MaybeLocal Invoke(Isolate* isolate, const MemberGroup& group, const MemberInfo& member, + Local receiver, const std::vector>& arguments, + bool setter, Local constructTarget) { + Local context = isolate->GetCurrentContext(); + const ModuleInfo& module = *group.module; + auto* state = Caches::StateFor(isolate); + LoadedModule* loaded = LoadedFor(isolate, &module); + if (state == nullptr || loaded == nullptr) { + return MaybeLocal(); + } + + std::vector slots; + SlotArena arena; + slots.reserve(arguments.size() + 1); + + if (!receiver.IsEmpty()) { + NSSwiftValue slot{}; + const TypeInfo& owner = module.types[member.owner]; + if (IsEnumKind(owner.kind)) { + ValueCode code; + code.kind = owner.kind == NSSwiftTypeEnum ? ValueCode::Kind::Enum : ValueCode::Kind::Tagged; + code.typeIndex = member.owner; + if (!Convert(isolate, context, module, member, 0, code, receiver, slot, arena)) { + return MaybeLocal(); + } + } else { + SwiftObjectWrapper* wrapper = SwiftWrapperOf(isolate, receiver); + if (!wrapper || wrapper->Module() != &module || + !module.IsA(wrapper->TypeIndex(), member.owner)) { + isolate->ThrowException(Exception::TypeError(tns::ToV8String( + isolate, "Illegal invocation: " + member.swiftName + " needs a " + owner.jsName))); + return MaybeLocal(); + } + slot.tag = NSSwiftTagObject; + slot.payload.object = wrapper->Object(); + } + slots.push_back(slot); + } + + if (setter) { + NSSwiftValue slot{}; + if (!Convert(isolate, context, module, member, 0, member.signature.result, arguments[0], slot, + arena)) { + return MaybeLocal(); + } + slots.push_back(slot); + } else { + for (size_t i = 0; i < arguments.size(); i++) { + NSSwiftValue slot{}; + if (!Convert(isolate, context, module, member, i, member.signature.parameters[i], + arguments[i], slot, arena)) { + return MaybeLocal(); + } + slots.push_back(slot); + } + } + + CallContext call; + call.api = &kAPI; + call.isolate = isolate; + call.context = context; + call.module = &module; + call.loaded = loaded; + call.state = state; + call.member = &member; + call.constructTarget = constructTarget; + call.resultCode = &member.signature.result; + + call.arena = &arena; + + NSSwiftThunk thunk = setter ? member.setter : member.thunk; + state->calls.push_back(&call); + thunk(&call, slots.empty() ? nullptr : slots.data(), static_cast(slots.size())); + state->calls.pop_back(); + + if (call.threw) { + return MaybeLocal(); + } + if (!call.callbackException.IsEmpty()) { + isolate->ThrowException(call.callbackException.Get(isolate)); + return MaybeLocal(); + } + if (!call.completed) { + isolate->ThrowException(Exception::Error( + tns::ToV8String(isolate, "Swift thunk for " + member.swiftName + " reported no result"))); + return MaybeLocal(); + } + return call.result; +} + +const MemberGroup* GroupOf(const FunctionCallbackInfo& info) { + return static_cast( + info.Data().As()->Value(v8::kExternalPointerTypeTagDefault)); +} + +std::vector> ArgumentsOf(const FunctionCallbackInfo& info, int first) { + std::vector> arguments; + for (int i = first; i < info.Length(); i++) { + arguments.push_back(info[i]); + } + return arguments; +} + +bool ReceiverIsEnumArgument(const MemberGroup& group) { + return IsInstanceKind(group.kind) && group.owner >= 0 && + IsEnumKind(group.module->types[group.owner].kind); +} + +// Methods, functions, and enum instance members (whose receiver, a case +// name, is the first argument). +void MethodCallback(const FunctionCallbackInfo& info) { + Isolate* isolate = info.GetIsolate(); + const MemberGroup& group = *GroupOf(info); + Local receiver; + int first = 0; + if (ReceiverIsEnumArgument(group)) { + if (info.Length() < 1) { + isolate->ThrowException(Exception::TypeError(tns::ToV8String( + isolate, group.jsName + " needs a " + group.module->types[group.owner].jsName + + " case name as its first argument"))); + return; + } + receiver = info[0]; + first = 1; + } else if (IsInstanceKind(group.kind)) { + receiver = info.This(); + } + + std::vector> arguments = ArgumentsOf(info, first); + Selection selection; + if (group.kind == NSSwiftMemberInstanceProperty) { + // Enum instance properties are exposed as functions of the case name. + selection.member = group.overloads[0]; + } else if (!Select(isolate, isolate->GetCurrentContext(), group, arguments, selection)) { + return; + } + Local result; + if (Invoke(isolate, group, *selection.member, receiver, selection.arguments, false, + Local()) + .ToLocal(&result)) { + info.GetReturnValue().Set(result); + } +} + +// One overload by its signature key (`obj['scale(by: Int)'](2)`). +void ExactCallback(const FunctionCallbackInfo& info) { + Isolate* isolate = info.GetIsolate(); + const MemberGroup& group = *GroupOf(info); + // Exact groups hold the single overload they were created for. + const MemberInfo& member = *group.overloads[0]; + Local receiver; + int first = 0; + if (ReceiverIsEnumArgument(group)) { + receiver = info.Length() > 0 ? info[0] : Local(v8::Undefined(isolate)); + first = 1; + } else if (IsInstanceKind(group.kind)) { + receiver = info.This(); + } + std::vector> arguments = ArgumentsOf(info, first); + if (arguments.size() != member.signature.parameters.size()) { + isolate->ThrowException(Exception::TypeError(tns::ToV8String( + isolate, member.swiftName + " expects " + + std::to_string(member.signature.parameters.size()) + " argument(s)"))); + return; + } + Local result; + if (Invoke(isolate, group, member, receiver, arguments, false, Local()) + .ToLocal(&result)) { + info.GetReturnValue().Set(result); + } +} + +void GetterCallback(const FunctionCallbackInfo& info) { + Isolate* isolate = info.GetIsolate(); + const MemberGroup& group = *GroupOf(info); + Local receiver = IsInstanceKind(group.kind) ? Local(info.This()) : Local(); + Local result; + if (Invoke(isolate, group, *group.overloads[0], receiver, {}, false, Local()) + .ToLocal(&result)) { + info.GetReturnValue().Set(result); + } +} + +void SetterCallback(const FunctionCallbackInfo& info) { + Isolate* isolate = info.GetIsolate(); + const MemberGroup& group = *GroupOf(info); + Local receiver = IsInstanceKind(group.kind) ? Local(info.This()) : Local(); + std::vector> arguments = {info.Length() > 0 ? info[0] + : Local(v8::Undefined(isolate))}; + Invoke(isolate, group, *group.overloads[0], receiver, arguments, true, Local()); +} + +void ConstructorCallback(const FunctionCallbackInfo& info) { + Isolate* isolate = info.GetIsolate(); + const TypeInfo& type = *static_cast( + info.Data().As()->Value(v8::kExternalPointerTypeTagDefault)); + if (!info.IsConstructCall()) { + isolate->ThrowException(Exception::TypeError(tns::ToV8String( + isolate, "Class constructor " + type.jsName + " cannot be invoked without 'new'"))); + return; + } + if (type.initializers == nullptr) { + isolate->ThrowException(Exception::TypeError( + tns::ToV8String(isolate, type.swiftName + " has no initializer callable from JavaScript"))); + return; + } + const MemberGroup& group = *type.initializers; + Selection selection; + if (!Select(isolate, isolate->GetCurrentContext(), group, ArgumentsOf(info, 0), selection)) { + return; + } + Local result; + if (Invoke(isolate, group, *selection.member, Local(), selection.arguments, false, + info.This()) + .ToLocal(&result)) { + // A failable initializer that fails produces null, which `new` cannot + // return; report it instead of yielding an unbacked object. + if (result->IsNull()) { + isolate->ThrowException(Exception::Error( + tns::ToV8String(isolate, selection.member->swiftName + " failed (returned nil)"))); + return; + } + info.GetReturnValue().Set(result); + } +} + +// --- Building a module's JS surface for one isolate -------------------------------- + +Local DataFor(Isolate* isolate, const void* pointer) { + return External::New(isolate, const_cast(pointer), v8::kExternalPointerTypeTagDefault); +} + +std::vector>& ExactGroups() { + // Single-overload groups backing signature keys; process-lifetime like the + // modules they point into. + static std::vector> groups; + return groups; +} + +std::mutex gExactGroupsMutex; + +robin_hood::unordered_map& ExactGroupIndex() { + static robin_hood::unordered_map index; + return index; +} + +const MemberGroup* ExactGroupFor(const MemberGroup& group, const MemberInfo& member) { + std::lock_guard lock(gExactGroupsMutex); + auto& index = ExactGroupIndex(); + auto it = index.find(&member); + if (it != index.end()) { + return it->second; + } + auto exact = std::make_unique(); + exact->module = group.module; + exact->owner = group.owner; + exact->kind = group.kind; + exact->jsName = group.jsName; + exact->overloads = {&member}; + const MemberGroup* result = exact.get(); + ExactGroups().push_back(std::move(exact)); + index.emplace(&member, result); + return result; +} + +// Keys reaching individual overloads: the Swift name when it is unique in the +// group, the typed key otherwise. +std::vector> OverloadKeys(const MemberGroup& group) { + std::vector> keys; + if (group.overloads.size() < 2) { + return keys; + } + robin_hood::unordered_map counts; + for (const MemberInfo* member : group.overloads) { + counts[member->swiftName]++; + } + for (const MemberInfo* member : group.overloads) { + keys.emplace_back( + counts[member->swiftName] == 1 ? member->swiftName : TypedKey(*group.module, *member), + member); + } + return keys; +} + +class Builder { + public: + Builder(Isolate* isolate, Local context, LoadedModule& loaded) + : _isolate(isolate), _context(context), _loaded(loaded), _module(*loaded.info) {} + + MaybeLocal Build() { + Local exports = Object::New(_isolate); + + _loaded.templates.resize(_module.types.size()); + std::vector> templates(_module.types.size()); + for (const TypeInfo& type : _module.types) { + if (IsEnumKind(type.kind)) { + continue; + } + Local tmpl = + FunctionTemplate::New(_isolate, ConstructorCallback, DataFor(_isolate, &type)); + tmpl->SetClassName(tns::ToV8String(_isolate, LastComponent(type.jsName))); + tmpl->InstanceTemplate()->SetInternalFieldCount(1); + templates[type.index] = tmpl; + } + for (const TypeInfo& type : _module.types) { + if (type.superIndex >= 0 && !templates[type.index].IsEmpty() && + !templates[type.superIndex].IsEmpty()) { + templates[type.index]->Inherit(templates[type.superIndex]); + } + } + + std::vector> enums(_module.types.size()); + for (const TypeInfo& type : _module.types) { + if (IsEnumKind(type.kind)) { + enums[type.index] = Object::New(_isolate); + } + } + + // Members onto templates first: a template cannot change once its + // function exists. + std::vector moduleGroups; + std::vector enumGroups; + for (const auto& group : _module.groups) { + if (group->owner < 0) { + moduleGroups.push_back(group.get()); + continue; + } + const TypeInfo& owner = _module.types[group->owner]; + if (IsEnumKind(owner.kind)) { + enumGroups.push_back(group.get()); + continue; + } + InstallOnTemplate(templates[group->owner], *group); + } + + std::vector> values(_module.types.size()); + for (const TypeInfo& type : _module.types) { + if (IsEnumKind(type.kind)) { + values[type.index] = enums[type.index]; + continue; + } + Local function; + if (!templates[type.index]->GetFunction(_context).ToLocal(&function)) { + return MaybeLocal(); + } + _loaded.templates[type.index].Reset(_isolate, templates[type.index]); + values[type.index] = function; + } + + // Nested types hang off their parent by JS path ("Polygon.Style"); a + // parent that is not bridged gets a plain namespace object. + std::map> containers; + for (const TypeInfo& type : _module.types) { + containers[type.jsName] = values[type.index]; + } + std::vector byDepth; + for (const TypeInfo& type : _module.types) { + byDepth.push_back(&type); + } + std::stable_sort(byDepth.begin(), byDepth.end(), [](const TypeInfo* a, const TypeInfo* b) { + return std::count(a->jsName.begin(), a->jsName.end(), '.') < + std::count(b->jsName.begin(), b->jsName.end(), '.'); + }); + std::vector> namespaces; + for (const TypeInfo* type : byDepth) { + Local container = exports; + std::string path; + size_t start = 0; + for (size_t dot = type->jsName.find('.'); dot != std::string::npos; + dot = type->jsName.find('.', start)) { + std::string component = type->jsName.substr(start, dot - start); + path += (path.empty() ? "" : ".") + component; + auto existing = containers.find(path); + if (existing == containers.end()) { + Local space = Object::New(_isolate); + if (!container->Set(_context, tns::ToV8String(_isolate, component), space) + .FromMaybe(false)) { + return MaybeLocal(); + } + existing = containers.emplace(path, space).first; + namespaces.push_back(space); + } + container = existing->second; + start = dot + 1; + } + if (!container + ->Set(_context, tns::ToV8String(_isolate, LastComponent(type->jsName)), + values[type->index]) + .FromMaybe(false)) { + return MaybeLocal(); + } + } + + for (const MemberGroup* group : enumGroups) { + if (!InstallOnObject(enums[group->owner], *group)) { + return MaybeLocal(); + } + } + for (const MemberGroup* group : moduleGroups) { + if (!InstallOnObject(exports, *group)) { + return MaybeLocal(); + } + } + for (Local enumObject : enums) { + if (!enumObject.IsEmpty()) { + enumObject->SetIntegrityLevel(_context, IntegrityLevel::kFrozen).Check(); + } + } + for (Local space : namespaces) { + space->SetIntegrityLevel(_context, IntegrityLevel::kFrozen).Check(); + } + exports->SetIntegrityLevel(_context, IntegrityLevel::kFrozen).Check(); + return exports; + } + + private: + Local MethodTemplate(const MemberGroup& group, + FunctionCallback callback = MethodCallback) { + Local tmpl = + FunctionTemplate::New(_isolate, callback, DataFor(_isolate, &group)); + tmpl->RemovePrototype(); + return tmpl; + } + + bool HasSetter(const MemberGroup& group) const { + return (group.overloads[0]->flags & NSSwiftMemberSettable) && + group.overloads[0]->setter != nullptr; + } + + void InstallOnTemplate(Local tmpl, const MemberGroup& group) { + Local name = tns::ToV8String(_isolate, group.jsName); + switch (group.kind) { + case NSSwiftMemberInitializer: + // Reached through `new`; see ConstructorCallback. + break; + case NSSwiftMemberInstanceMethod: + tmpl->PrototypeTemplate()->Set(name, MethodTemplate(group)); + for (const auto& key : OverloadKeys(group)) { + tmpl->PrototypeTemplate()->Set( + tns::ToV8String(_isolate, key.first), + MethodTemplate(*ExactGroupFor(group, *key.second), ExactCallback)); + } + break; + case NSSwiftMemberStaticMethod: + tmpl->Set(name, MethodTemplate(group)); + for (const auto& key : OverloadKeys(group)) { + tmpl->Set(tns::ToV8String(_isolate, key.first), + MethodTemplate(*ExactGroupFor(group, *key.second), ExactCallback)); + } + break; + case NSSwiftMemberInstanceProperty: + tmpl->PrototypeTemplate()->SetAccessorProperty( + name, MethodTemplate(group, GetterCallback), + HasSetter(group) ? MethodTemplate(group, SetterCallback) : Local()); + break; + case NSSwiftMemberStaticProperty: + tmpl->SetAccessorProperty( + name, MethodTemplate(group, GetterCallback), + HasSetter(group) ? MethodTemplate(group, SetterCallback) : Local()); + break; + default: + break; + } + } + + bool SetFunction(Local target, const std::string& key, Local tmpl) { + Local function; + return tmpl->GetFunction(_context).ToLocal(&function) && + target->Set(_context, tns::ToV8String(_isolate, key), function).FromMaybe(false); + } + + // Enum and module-level members, on a plain object. + bool InstallOnObject(Local target, const MemberGroup& group) { + Local name = tns::ToV8String(_isolate, group.jsName); + switch (group.kind) { + case NSSwiftMemberEnumCase: + if (group.module->types[group.owner].kind == NSSwiftTypeTaggedEnum) { + // Case values are objects JS builds itself. + return true; + } + // A case's JS value is its name. + return target + ->DefineOwnProperty(_context, name, name, + static_cast(ReadOnly | DontDelete)) + .FromMaybe(false); + case NSSwiftMemberInitializer: + // Enum initializers (`init?(rawValue:)`) yield a case name, which + // `new` cannot produce. + return SetFunction(target, "init", MethodTemplate(group)); + case NSSwiftMemberStaticProperty: + case NSSwiftMemberVariable: { + Local getter; + Local setter; + if (!MethodTemplate(group, GetterCallback)->GetFunction(_context).ToLocal(&getter)) { + return false; + } + if (HasSetter(group) && + !MethodTemplate(group, SetterCallback)->GetFunction(_context).ToLocal(&setter)) { + return false; + } + target->SetAccessorProperty(name, getter, setter); + return true; + } + case NSSwiftMemberInstanceProperty: + case NSSwiftMemberInstanceMethod: + case NSSwiftMemberStaticMethod: + case NSSwiftMemberFunction: { + if (!SetFunction(target, group.jsName, MethodTemplate(group))) { + return false; + } + for (const auto& key : OverloadKeys(group)) { + if (!SetFunction(target, key.first, + MethodTemplate(*ExactGroupFor(group, *key.second), ExactCallback))) { + return false; + } + } + return true; + } + default: + return true; + } + } + + Isolate* _isolate; + Local _context; + LoadedModule& _loaded; + const ModuleInfo& _module; +}; + +void LoadModuleCallback(const FunctionCallbackInfo& info) { + Isolate* isolate = info.GetIsolate(); + if (info.Length() < 1 || !info[0]->IsString()) { + isolate->ThrowException( + Exception::TypeError(tns::ToV8String(isolate, "The Swift module name must be a string"))); + return; + } + Local exports; + if (LoadModule(isolate->GetCurrentContext(), tns::ToString(isolate, info[0])).ToLocal(&exports)) { + info.GetReturnValue().Set(exports); + } +} + +void ModuleInfoCallback(const FunctionCallbackInfo& info) { + Isolate* isolate = info.GetIsolate(); + Local context = isolate->GetCurrentContext(); + if (info.Length() < 1 || !info[0]->IsString()) { + return; + } + std::string error; + std::shared_ptr module = LoadModuleInfo(tns::ToString(isolate, info[0]), error); + if (!module) { + isolate->ThrowException(Exception::Error(tns::ToV8String(isolate, error))); + return; + } + Local result = Object::New(isolate); + result->Set(context, tns::ToV8String(isolate, "name"), tns::ToV8String(isolate, module->name)) + .Check(); + result + ->Set(context, tns::ToV8String(isolate, "fingerprint"), + tns::ToV8String(isolate, module->fingerprint)) + .Check(); + result + ->Set(context, tns::ToV8String(isolate, "abiVersion"), + v8::Number::New(isolate, module->abiVersion)) + .Check(); + result + ->Set(context, tns::ToV8String(isolate, "members"), + v8::Number::New(isolate, static_cast(module->members.size()))) + .Check(); + info.GetReturnValue().Set(result); +} + +} // namespace + +MaybeLocal LoadModule(Local context, const std::string& name) { + Isolate* isolate = v8::Isolate::GetCurrent(); + if (!IsValidModuleName(name)) { + isolate->ThrowException(Exception::TypeError( + tns::ToV8String(isolate, "'" + name + "' is not a valid Swift module name"))); + return MaybeLocal(); + } + + auto* state = Caches::StateFor(isolate); + if (state == nullptr) { + return MaybeLocal(); + } + auto cached = state->modules.find(name); + if (cached != state->modules.end()) { + return cached->second->exports.Get(isolate); + } + + std::string error; + std::shared_ptr module = LoadModuleInfo(name, error); + if (!module) { + isolate->ThrowException(Exception::Error(tns::ToV8String(isolate, error))); + return MaybeLocal(); + } + + auto loaded = std::make_unique(); + loaded->info = module; + LoadedModule* raw = loaded.get(); + state->byInfo[module.get()] = raw; + Local exports; + if (!Builder(isolate, context, *raw).Build().ToLocal(&exports)) { + state->byInfo.erase(module.get()); + return MaybeLocal(); + } + loaded->exports.Reset(isolate, exports); + state->modules.emplace(name, std::move(loaded)); + return exports; +} + +MaybeLocal CreateBinding(Local context) { + Isolate* isolate = v8::Isolate::GetCurrent(); + Local binding = Object::New(isolate); + Local loadModule; + Local moduleInfo; + if (!v8::Function::New(context, LoadModuleCallback).ToLocal(&loadModule) || + !v8::Function::New(context, ModuleInfoCallback).ToLocal(&moduleInfo) || + !binding->Set(context, tns::ToV8String(isolate, "loadModule"), loadModule).FromMaybe(false) || + !binding->Set(context, tns::ToV8String(isolate, "moduleInfo"), moduleInfo).FromMaybe(false) || + !binding + ->Set(context, tns::ToV8String(isolate, "abiVersion"), + v8::Number::New(isolate, NS_SWIFT_ABI_VERSION)) + .FromMaybe(false)) { + return MaybeLocal(); + } + return binding; +} + +} // namespace SwiftInterop +} // namespace tns diff --git a/NativeScript/runtime/js/ns-swift.js b/NativeScript/runtime/js/ns-swift.js new file mode 100644 index 00000000..c58dda64 --- /dev/null +++ b/NativeScript/runtime/js/ns-swift.js @@ -0,0 +1,27 @@ +"use strict"; + +// The `ns:swift` builtin module: JavaScript access to Swift modules whose +// generated interop thunks are linked into the app. `module(name)` returns +// the module's types and top-level functions; see docs/swift-interop.md. + +const { abiVersion, loadModule, moduleInfo } = binding; +const { ObjectFreeze, TypeError } = primordials; + +function module(name) { + if (typeof name !== "string") { + throw new TypeError('The "name" argument must be a Swift module name.'); + } + return loadModule(name); +} + +function info(name) { + if (typeof name !== "string") { + throw new TypeError('The "name" argument must be a Swift module name.'); + } + return moduleInfo(name); +} + +exports.abiVersion = abiVersion; +exports.module = module; +exports.info = info; +ObjectFreeze(exports); diff --git a/TestFixtures/exported-symbols.txt b/TestFixtures/exported-symbols.txt index 9a915ec8..541b69ca 100644 --- a/TestFixtures/exported-symbols.txt +++ b/TestFixtures/exported-symbols.txt @@ -221,3 +221,4 @@ __SCNVector3FromFloat3 __SCNVector4FromFloat4 __SCNMatrix4FromMat4 _getStructFromCallback +_ns_swift_register_SwiftDemo diff --git a/TestRunner/SwiftRuntimeLinkage.swift b/TestRunner/SwiftRuntimeLinkage.swift new file mode 100644 index 00000000..92a400eb --- /dev/null +++ b/TestRunner/SwiftRuntimeLinkage.swift @@ -0,0 +1,3 @@ +// TestRunner is an Objective-C app that links the SwiftDemo static library. +// A Swift source in the app target is what makes Xcode link the Swift runtime +// libraries that library's objects reference. diff --git a/TestRunner/app/tests/SwiftInteropTests.js b/TestRunner/app/tests/SwiftInteropTests.js new file mode 100644 index 00000000..93c1508b --- /dev/null +++ b/TestRunner/app/tests/SwiftInteropTests.js @@ -0,0 +1,705 @@ +// End-to-end Swift interop: the SwiftDemo fixture +// (metadata-generator/TestFixtures/SwiftDemo) is linked into TestRunner with +// the thunks the metadata generator emits for it, and reached through ns:swift. +describe("ns:swift", function () { + var swift = require("ns:swift"); + var SwiftDemo = swift.module("SwiftDemo"); + + describe("modules", function () { + it("exports a frozen loader", function () { + expect(Object.isFrozen(swift)).toBe(true); + expect(Object.keys(swift).sort()).toEqual(["abiVersion", "info", "module"]); + expect(swift.abiVersion).toBe(7); + }); + + it("returns one frozen namespace per module", function () { + expect(swift.module("SwiftDemo")).toBe(SwiftDemo); + expect(Object.isFrozen(SwiftDemo)).toBe(true); + }); + + it("describes the linked module", function () { + var info = swift.info("SwiftDemo"); + expect(info.name).toBe("SwiftDemo"); + expect(info.abiVersion).toBe(7); + expect(info.fingerprint).toMatch(/^[0-9a-f]{16}$/); + expect(info.members).toBeGreaterThan(0); + }); + + it("reports modules that are not linked", function () { + expect(function () { swift.module("NoSuchSwiftModule"); }) + .toThrowError(/NoSuchSwiftModule.*not linked/); + expect(function () { swift.module("bad name"); }).toThrowError(TypeError); + }); + + it("resolves ns:swift/ to the module's exports", function () { + expect(require("ns:swift/SwiftDemo")).toBe(SwiftDemo); + expect(function () { require("ns:swift/NoSuchSwiftModule"); }) + .toThrowError(/not linked/); + }); + + it("imports ns:swift/ as an ES module", function (done) { + import("ns:swift/SwiftDemo").then(function (namespace) { + expect(namespace.Demo).toBe(SwiftDemo.Demo); + expect(namespace.default).toBe(SwiftDemo); + expect(new namespace.Demo().greet("esm")).toBe("Hello, esm"); + done(); + }, function (error) { + fail(error); + done(); + }); + }); + + it("exposes only the generated surface", function () { + // Unsupported declarations (async, generic, closures, ...) are absent. + expect(SwiftDemo.Loader.prototype.transform).toBeUndefined(); + expect(SwiftDemo.Loader.prototype.withCompletion).toBeUndefined(); + }); + }); + + describe("classes", function () { + it("constructs and calls instance methods", function () { + var demo = new SwiftDemo.Demo(); + expect(demo instanceof SwiftDemo.Demo).toBe(true); + expect(demo.greet("NativeScript")).toBe("Hello, NativeScript"); + }); + + it("dispatches overloads by arity", function () { + var demo = new SwiftDemo.Demo(); + expect(demo.greet("a", 2)).toBe("Hello, aHello, a"); + expect(demo["greet(name:times:)"]("b", 1)).toBe("Hello, b"); + }); + + it("reads static properties", function () { + expect(SwiftDemo.Demo.version).toBe("1.0"); + }); + + it("requires new", function () { + expect(function () { SwiftDemo.Demo(); }).toThrowError(TypeError); + }); + + it("models inheritance", function () { + var square = new SwiftDemo.Square(3); + expect(square instanceof SwiftDemo.Square).toBe(true); + expect(square instanceof SwiftDemo.Polygon).toBe(true); + expect(square.area).toBe(9); + expect(square.name).toBe("square"); + expect(square.vertexCount).toBe(4); + expect(SwiftDemo.Square.sides).toBe(4); + // Square overrides scale(by: Double) and inherits scale(by: Int) + // and scale(x:y:). + expect(function () { square.scale(2); }).toThrowError(TypeError, /Ambiguous/); + square["scale(by: Double)"](2); + expect(square.side).toBe(6); + square.scale(1, 1); + }); + + it("wraps returned objects with their dynamic type", function () { + var made = SwiftDemo.Polygon.make(); + expect(made instanceof SwiftDemo.Polygon).toBe(true); + expect(made.vertexCount).toBe(3); + expect(SwiftDemo.Polygon.describe(made)).toBe("made"); + expect(SwiftDemo.Polygon.describe(new SwiftDemo.Square(1))).toBe("square"); + expect(SwiftDemo.Polygon.describe(null)).toBe("none"); + }); + + it("accepts labeled initializer arguments", function () { + var polygon = new SwiftDemo.Polygon({ name: "tri", vertexCount: 3 }); + expect(polygon.name).toBe("tri"); + expect(polygon.vertexCount).toBe(3); + }); + + it("reports failed failable initializers", function () { + expect(new SwiftDemo.Polygon("hex").name).toBe("hex"); + expect(function () { new SwiftDemo.Polygon(""); }).toThrowError(/failed/); + }); + + it("rejects calls it cannot resolve", function () { + var polygon = new SwiftDemo.Polygon("p"); + // scale(by: Double) and scale(by: Int) both accept a number. + expect(function () { polygon.scale(2); }).toThrowError(TypeError, /Ambiguous.*scale\(by: Int\)/); + polygon["scale(by: Int)"](2); + polygon["scale(by: Double)"](2.5); + polygon.scale(1, 2); + expect(function () { polygon.scale("x"); }).toThrowError(TypeError, /No overload/); + }); + + it("rejects receivers of the wrong type", function () { + var greet = SwiftDemo.Demo.prototype.greet; + expect(function () { greet.call({}, "x"); }).toThrowError(TypeError, /Illegal invocation/); + expect(function () { greet.call(new SwiftDemo.Loader(), "x"); }).toThrowError(TypeError); + }); + + it("calls nonisolated actor members", function () { + expect(new SwiftDemo.Counter().label()).toBe("counter"); + }); + + it("calls deprecated and availability-gated members", function () { + var loader = new SwiftDemo.Loader(); + expect(loader.legacyFetch()).toBeUndefined(); + expect(loader.modernOnly()).toBeUndefined(); + }); + }); + + describe("structs", function () { + it("constructs positionally and by label", function () { + var a = new SwiftDemo.Point(2, 3); + var b = new SwiftDemo.Point({ x: 2, y: 3 }); + expect(a.x).toBe(2); + expect(b.y).toBe(3); + expect(a.length).toBeCloseTo(Math.sqrt(13), 10); + expect(a.description).toBe("(2.0, 3.0)"); + }); + + it("mutates its own copy", function () { + var point = new SwiftDemo.Point(1, 1); + point.x = 5; + expect(point.x).toBe(5); + + var ring = new SwiftDemo.Ring(new SwiftDemo.Point(0, 0), new SwiftDemo.Point(1, 1)); + var outer = ring.outer; + outer.x = 100; + // `outer` is a copy; the ring's value is unchanged. + expect(ring.outer.x).toBe(1); + ring.expand(2); + expect(ring.outer.x).toBe(3); + expect(outer.x).toBe(100); + }); + + it("passes structs by value", function () { + var inner = new SwiftDemo.Point(0, 0); + var ring = new SwiftDemo.Ring(inner, new SwiftDemo.Point(1, 1)); + inner.x = 9; + expect(ring.inner.x).toBe(0); + }); + }); + + describe("enums", function () { + it("represents cases by name", function () { + expect(SwiftDemo.Flavor.vanilla).toBe("vanilla"); + expect(SwiftDemo.Flavor.chocolate).toBe("chocolate"); + expect(Object.isFrozen(SwiftDemo.Flavor)).toBe(true); + expect(SwiftDemo.defaultFlavor).toBe("vanilla"); + }); + + it("initializes from raw values", function () { + expect(SwiftDemo.Flavor.init(1)).toBe("chocolate"); + expect(SwiftDemo.Flavor.init(7)).toBe(null); + expect(SwiftDemo.Precipitation.init("snow")).toBe("snow"); + }); + + it("keeps a case named none distinct from nil", function () { + expect(SwiftDemo.Precipitation.none).toBe("none"); + expect(SwiftDemo.Precipitation.init("none")).toBe("none"); + expect(SwiftDemo.Precipitation.init("hail")).toBe(null); + }); + + it("calls instance members with the case as receiver", function () { + expect(SwiftDemo.Flavor.description("chocolate")).toBe("chocolate"); + expect(function () { SwiftDemo.Flavor.description("mint"); }).toThrowError(TypeError); + }); + }); + + describe("values", function () { + it("calls module functions and variables", function () { + var point = SwiftDemo.makeDefaultPoint(); + expect(point instanceof SwiftDemo.Point).toBe(true); + expect(point.x).toBe(0); + + var before = SwiftDemo.globalCounter; + SwiftDemo.globalCounter = before + 41; + expect(SwiftDemo.globalCounter).toBe(before + 41); + }); + + it("checks integer ranges", function () { + expect(SwiftDemo.echoInt8(-128)).toBe(-128); + expect(function () { SwiftDemo.echoInt8(128); }).toThrowError(RangeError); + expect(function () { SwiftDemo.echoInt8(1.5); }).toThrowError(TypeError); + expect(SwiftDemo.echoUInt64(5n)).toBe(5); + expect(function () { SwiftDemo.echoUInt64(-1); }).toThrowError(RangeError); + // Int.max has no exact JS number. + expect(function () { SwiftDemo.largestInt(); }).toThrowError(RangeError); + }); + + it("maps optionals to null", function () { + expect(SwiftDemo.shout("hi")).toBe("HI"); + expect(SwiftDemo.shout(null)).toBe(null); + expect(SwiftDemo.shout(undefined)).toBe(null); + }); + + it("checks argument types", function () { + var demo = new SwiftDemo.Demo(); + expect(function () { demo.greet(5); }).toThrowError(TypeError); + expect(function () { new SwiftDemo.Ring(1, 2); }).toThrowError(TypeError); + }); + + it("turns Swift errors into JS errors", function () { + expect(SwiftDemo.checkedSide(2)).toBe(2); + try { + SwiftDemo.checkedSide(-1); + fail("expected a throw"); + } catch (e) { + expect(e instanceof Error).toBe(true); + expect(e.name).toBe("SwiftError"); + expect(e.swiftType).toBe("SwiftDemo.ShapeError"); + expect(e.message).toContain("invalidSide(-1.0)"); + } + }); + }); + + describe("nested types", function () { + it("hangs nested types off their parent", function () { + expect(SwiftDemo.Polygon.Style.dashed).toBe("dashed"); + expect(SwiftDemo.Polygon.Style.init("solid")).toBe("solid"); + expect(new SwiftDemo.Polygon("tri").style).toBe("solid"); + expect(new SwiftDemo.Polygon({ name: "quad", vertexCount: 4 }).style).toBe("dashed"); + + var metrics = new SwiftDemo.Polygon.Metrics({ perimeter: 3 }); + expect(metrics instanceof SwiftDemo.Polygon.Metrics).toBe(true); + expect(metrics.perimeter).toBe(3); + var computed = new SwiftDemo.Polygon({ name: "tri", vertexCount: 3 }).metrics(2); + expect(computed instanceof SwiftDemo.Polygon.Metrics).toBe(true); + expect(computed.perimeter).toBe(6); + }); + + it("gives an unbridged parent a frozen namespace", function () { + // Job (whose case carries a closure) is not bridged. + expect(typeof SwiftDemo.Job).toBe("object"); + expect(Object.isFrozen(SwiftDemo.Job)).toBe(true); + expect(Object.keys(SwiftDemo.Job)).toEqual(["Ticket"]); + expect(new SwiftDemo.Job.Ticket(4).id).toBe(4); + expect(new SwiftDemo.Measurement.Unit("m").symbol).toBe("m"); + }); + }); + + describe("collections and Foundation values", function () { + it("copies arrays both ways", function () { + expect(SwiftDemo.names(3)).toEqual(["n0", "n1", "n2"]); + expect(SwiftDemo.total([1, 2, 3.5])).toBe(6.5); + expect(SwiftDemo.mirrored([[1, 2], [3]])).toEqual([[2, 1], [3]]); + expect(SwiftDemo.allFlavors()).toEqual(["vanilla", "chocolate"]); + var center = SwiftDemo.centroid([new SwiftDemo.Point(0, 0), new SwiftDemo.Point(2, 2)]); + expect(center instanceof SwiftDemo.Point).toBe(true); + expect(center.x).toBe(1); + var trackers = SwiftDemo.trackers([4, 5]); + expect(trackers.length).toBe(2); + expect(trackers[0] instanceof SwiftDemo.Tracker).toBe(true); + expect(trackers[1].id).toBe(5); + }); + + it("copies [String: T] to and from plain objects", function () { + expect(SwiftDemo.wordCounts(["a", "b", "a"])).toEqual({ a: 2, b: 1 }); + expect(SwiftDemo.lengths({ x: "abc", y: "" })).toEqual({ x: 3, y: 0 }); + var loader = new SwiftDemo.Loader(); + expect(loader.lookup({ a: 1 }, "a")).toBe(1); + expect(loader.lookup({}, "z")).toBe(null); + }); + + it("checks collection elements", function () { + expect(function () { SwiftDemo.total("x"); }).toThrowError(TypeError); + expect(function () { SwiftDemo.total([1, "x"]); }).toThrowError(TypeError); + expect(function () { SwiftDemo.mirrored([[1.5]]); }).toThrowError(TypeError); + expect(function () { SwiftDemo.lengths({ x: 1 }); }).toThrowError(TypeError); + }); + + it("maps Date to JS Date", function () { + var next = SwiftDemo.nextDay(new Date(0)); + expect(next instanceof Date).toBe(true); + expect(next.getTime()).toBe(86400000); + expect(function () { SwiftDemo.nextDay(0); }).toThrowError(TypeError); + }); + + it("maps URL to JS URL and accepts strings", function () { + expect(SwiftDemo.host("https://example.com/x")).toBe("example.com"); + expect(SwiftDemo.host(new URL("https://a.example/"))).toBe("a.example"); + var resolved = SwiftDemo.resolve("c", "https://x.example/a/"); + expect(resolved instanceof URL).toBe(true); + expect(resolved.href).toBe("https://x.example/a/c"); + }); + + it("maps Data to Uint8Array and accepts any buffer", function () { + expect(SwiftDemo.checksum(new Uint8Array([1, 2, 3]))).toBe(6); + expect(SwiftDemo.checksum(new Uint8Array([1, 2, 3]).buffer)).toBe(6); + expect(SwiftDemo.checksum(new Uint8Array([9, 1, 2]).subarray(1))).toBe(3); + var bytes = SwiftDemo.ramp(4); + expect(bytes instanceof Uint8Array).toBe(true); + expect(Array.prototype.slice.call(bytes)).toEqual([0, 1, 2, 3]); + }); + + it("resolves async collections", function (done) { + SwiftDemo.namesLater(2).then(function (names) { + expect(names).toEqual(["n0", "n1"]); + done(); + }, function (error) { + fail(error); + done(); + }); + }); + }); + + describe("async", function () { + it("resolves async functions with their result", function (done) { + var loader = new SwiftDemo.Loader(); + var waited = loader.wait(0.001); + expect(waited instanceof Promise).toBe(true); + waited.then(function (value) { + expect(value).toBeUndefined(); + return SwiftDemo.delayedEcho("later", 0.001); + }).then(function (text) { + expect(text).toBe("later"); + done(); + }, function (error) { + fail(error); + done(); + }); + }); + + it("rejects with the Swift error", function (done) { + SwiftDemo.delayedEcho("x", -1).then(function () { + fail("expected a rejection"); + done(); + }, function (error) { + expect(error.name).toBe("SwiftError"); + expect(error.swiftType).toBe("SwiftDemo.ShapeError"); + done(); + }); + }); + + it("resolves to wrapped Swift objects", function (done) { + SwiftDemo.makeTrackerLater(7).then(function (tracker) { + expect(tracker instanceof SwiftDemo.Tracker).toBe(true); + expect(tracker.id).toBe(7); + expect(tracker.same()).toBe(tracker); + done(); + }, function (error) { + fail(error); + done(); + }); + }); + + it("awaits actor members from outside the actor", function (done) { + var counter = new SwiftDemo.Counter(); + expect(counter.label()).toBe("counter"); + counter.increment().then(function (value) { + expect(value).toBe(1); + return counter.value; + }).then(function (value) { + expect(value).toBe(1); + return counter.step; + }).then(function (step) { + expect(step).toBe(1); + done(); + }, function (error) { + fail(error); + done(); + }); + }); + + it("runs main-actor members on the main thread", function (done) { + var palette = new SwiftDemo.Palette(); + expect(palette.stroke()).toBe(1); + expect(palette.strokes).toBe(1); + palette.strokeLater().then(function (strokes) { + expect(strokes).toBe(2); + done(); + }, function (error) { + fail(error); + done(); + }); + }); + + it("serves worker isolates their own objects", function (done) { + var worker = new Worker("./swiftInteropWorker.js"); + worker.onmessage = function (event) { + expect(event.data.greeting).toBe("Hello, worker"); + expect(event.data.palette).toMatch(/isolated to the main actor/); + expect(event.data.trackerId).toBe(5); + expect(event.data.echo).toBe("from worker"); + expect(event.data.callback).toBe("hi worker"); + worker.terminate(); + done(); + }; + worker.onerror = function (event) { + worker.terminate(); + fail("worker error: " + event.message); + done(); + }; + }); + }); + + describe("enums with associated values", function () { + it("returns cases as objects naming the case", function () { + expect(SwiftDemo.measure(2, 3)).toEqual({ case: "area", width: 2, height: 3 }); + expect(SwiftDemo.measure(2, null)).toEqual({ case: "length", value: 2 }); + expect(SwiftDemo.measure(0, null)).toEqual({ case: "none" }); + expect(SwiftDemo.measurements()).toEqual([ + { case: "length", value: 1 }, + { case: "area", width: 2, height: 3 }, + { case: "none" }, + ]); + }); + + it("accepts case objects", function () { + expect(SwiftDemo.area({ case: "area", width: 2, height: 4 })).toBe(8); + expect(SwiftDemo.area({ case: "none" })).toBe(0); + expect(SwiftDemo.explain({ case: "tooManySides", count: 5, limit: 4 })).toBe("5 > 4"); + expect(SwiftDemo.explain({ case: "invalidSide", value: 1.5 })).toBe("invalid side 1.5"); + expect(SwiftDemo.Measurement.isNone({ case: "none" })).toBe(true); + expect(SwiftDemo.Measurement.isNone({ case: "length", value: 1 })).toBe(false); + }); + + it("refuses unknown cases and mistyped values", function () { + expect(function () { SwiftDemo.area({ case: "circle" }); }) + .toThrowError(TypeError, /case of Measurement/); + expect(function () { SwiftDemo.area({ case: "area", width: "2", height: 1 }); }) + .toThrowError(TypeError); + expect(function () { SwiftDemo.area("area"); }).toThrowError(TypeError); + }); + + it("round-trips recursive enums", function () { + var formula = { + case: "sum", + 0: { case: "number", value: 1 }, + 1: { case: "negate", value: { case: "number", value: 4 } }, + }; + expect(SwiftDemo.Formula.value(formula)).toBe(-3); + expect(SwiftDemo.simplify(formula)).toEqual({ case: "number", value: -3 }); + }); + + it("carries objects, structs, enums, optionals and arrays", function () { + var tracker = new SwiftDemo.Tracker(3); + expect(SwiftDemo.echo({ case: "tracker", value: tracker }).value).toBe(tracker); + var point = SwiftDemo.echo({ case: "point", value: new SwiftDemo.Point({ x: 1, y: 2 }) }).value; + expect(point instanceof SwiftDemo.Point).toBe(true); + expect(point.x).toBe(1); + expect(SwiftDemo.echo({ case: "flavor", value: "chocolate" })) + .toEqual({ case: "flavor", value: "chocolate" }); + expect(SwiftDemo.echo({ case: "maybe", value: null })).toEqual({ case: "maybe", value: null }); + expect(SwiftDemo.echo({ case: "maybe" })).toEqual({ case: "maybe", value: null }); + expect(SwiftDemo.echo({ case: "maybe", value: 7 })).toEqual({ case: "maybe", value: 7 }); + expect(SwiftDemo.echo({ case: "names", value: ["a", "b"] })) + .toEqual({ case: "names", value: ["a", "b"] }); + }); + + it("resolves async results and passes cases to closures", function (done) { + var received; + SwiftDemo.onMeasure(function (measurement) { received = measurement; }); + expect(received).toEqual({ case: "area", width: 1, height: 2 }); + SwiftDemo.measureLater(5).then(function (measurement) { + expect(measurement).toEqual({ case: "length", value: 5 }); + done(); + }, function (error) { + fail(error); + done(); + }); + }); + }); + + describe("Objective-C objects", function () { + it("passes NativeScript's Objective-C wrappers", function () { + var view = UIView.new(); + view.tag = 7; + expect(SwiftDemo.describe(view)).toBe("UIView 7"); + var label = UILabel.new(); + label.tag = 3; + expect(SwiftDemo.tags([view, label])).toEqual([7, 3]); + }); + + it("returns objects with their Objective-C identity", function () { + var view = UIView.new(); + expect(SwiftDemo.firstSubview(view)).toBeNull(); + var child = UIView.new(); + view.addSubview(child); + expect(SwiftDemo.firstSubview(view)).toBe(child); + + var label = SwiftDemo.makeLabel("hello"); + expect(label instanceof UILabel).toBe(true); + expect(label.text).toBe("hello"); + }); + + it("round-trips Swift classes that are Objective-C visible", function (done) { + var note = SwiftDemo.makeNote("memo"); + expect(note instanceof NSObject).toBe(true); + expect(SwiftDemo.text(note)).toBe("memo"); + SwiftDemo.noteLater("later").then(function (later) { + expect(SwiftDemo.text(later)).toBe("later"); + done(); + }, function (error) { + fail(error); + done(); + }); + }); + + it("refuses other values", function () { + expect(function () { SwiftDemo.describe({}); }).toThrowError(TypeError); + expect(function () { SwiftDemo.describe(NSObject.new()); }).toThrowError(TypeError); + expect(function () { SwiftDemo.text(UIView.new()); }).toThrowError(TypeError); + }); + }); + + describe("inout parameters", function () { + it("writes the final value back to the reference object", function () { + var counter = { value: 41 }; + SwiftDemo.bump(counter); + expect(counter.value).toBe(42); + + var words = { value: ["a"] }; + SwiftDemo.append("b", words); + expect(words.value).toEqual(["a", "b"]); + + var name = { value: "x" }; + SwiftDemo.clear(name); + expect(name.value).toBeNull(); + }); + + it("writes back structs and objects", function () { + var point = new SwiftDemo.Point(1, 2); + var ref = { value: point }; + new SwiftDemo.Loader().update(ref); + expect(ref.value.x).toBe(2); + // Value semantics: the struct passed in is a separate copy. + expect(point.x).toBe(1); + + var first = new SwiftDemo.Tracker(1); + var second = new SwiftDemo.Tracker(2); + var a = { value: first }; + var b = { value: second }; + SwiftDemo.swapTrackers(a, b); + expect(a.value).toBe(second); + expect(b.value).toBe(first); + }); + + it("leaves the reference unchanged when the call throws", function () { + var even = { value: 8 }; + SwiftDemo.halve(even); + expect(even.value).toBe(4); + var odd = { value: 3 }; + expect(function () { SwiftDemo.halve(odd); }).toThrowError(/invalidSide/); + expect(odd.value).toBe(3); + }); + + it("requires a reference object", function () { + expect(function () { SwiftDemo.bump(1); }).toThrowError(TypeError, /inout Int/); + expect(function () { SwiftDemo.bump({ value: "1" }); }).toThrowError(TypeError); + }); + }); + + describe("closures", function () { + it("calls JS functions passed for closures while the call runs", function () { + var ticks = []; + SwiftDemo.countdown(3, function (value, last) { + ticks.push([value, last]); + }); + expect(ticks).toEqual([[3, false], [2, false], [1, false], [0, true]]); + + var loader = new SwiftDemo.Loader(); + var seen = []; + loader.each(function (value) { seen.push(value); }); + expect(seen).toEqual([]); + }); + + it("throws a callback's exception from the call and skips later calls", function () { + var calls = 0; + expect(function () { + SwiftDemo.countdown(5, function () { + calls++; + throw new Error("stop"); + }); + }).toThrowError("stop"); + expect(calls).toBe(1); + }); + + it("refuses values that are not functions", function () { + expect(function () { SwiftDemo.countdown(1, 5); }) + .toThrowError(TypeError, /countdown.*\(Int, Bool\) -> Void/); + }); + + it("runs closures called from other threads on the JS thread", function (done) { + SwiftDemo.greetLater("ns", function (greeting) { + expect(greeting).toBe("hi ns"); + expect(NSThread.isMainThread).toBe(true); + SwiftDemo.greetLater(null, function (nothing) { + expect(nothing).toBeNull(); + done(); + }); + }); + }); + + it("keeps escaping closures until Swift releases them", function (done) { + var notifier = new SwiftDemo.Notifier(); + var received = []; + notifier.subscribe(function (message) { + received.push(message); + if (message === "later") { + expect(received).toEqual(["now", "later"]); + notifier.clear(); + expect(notifier.count).toBe(0); + done(); + } + }); + gc(); + expect(notifier.count).toBe(1); + notifier.publish("now"); + expect(received).toEqual(["now"]); + notifier.publishLater("later"); + }); + + it("releases the JS function once Swift drops the closure", function (done) { + var notifier = new SwiftDemo.Notifier(); + var handler = function () {}; + var weakHandler = new WeakRef(handler); + notifier.subscribe(handler); + handler = null; + setTimeout(function () { + gc(); + expect(!!weakHandler.deref()).toBe(true); + notifier.clear(); + setTimeout(function () { + gc(); + expect(!!weakHandler.deref()).toBe(false); + done(); + }, 0); + }, 0); + }); + }); + + describe("identity and lifetime", function () { + it("returns the same wrapper for the same object", function () { + expect(SwiftDemo.Polygon.shared).toBe(SwiftDemo.Polygon.shared); + var tracker = new SwiftDemo.Tracker(1); + expect(tracker.same()).toBe(tracker); + }); + + it("releases Swift objects when their wrappers are collected", function () { + // Settle trackers left by earlier tests before taking the baseline. + for (var settle = 0; settle < 3; settle++) { + gc(); + } + var baseline = SwiftDemo.Tracker.liveCount; + (function () { + for (var i = 0; i < 100; i++) { + new SwiftDemo.Tracker(i); + } + })(); + expect(SwiftDemo.Tracker.liveCount).toBe(baseline + 100); + for (var attempt = 0; attempt < 5 && SwiftDemo.Tracker.liveCount > baseline; attempt++) { + gc(); + } + expect(SwiftDemo.Tracker.liveCount).toBe(baseline); + }); + + it("keeps objects alive while referenced", function () { + var tracker = new SwiftDemo.Tracker(42); + gc(); + gc(); + expect(tracker.id).toBe(42); + expect(tracker.same()).toBe(tracker); + }); + + it("rewraps an object after its wrapper was collected", function () { + (function () { SwiftDemo.Polygon.shared.name; })(); + gc(); + gc(); + expect(SwiftDemo.Polygon.shared.name).toBe("shared"); + }); + }); +}); diff --git a/TestRunner/app/tests/index.js b/TestRunner/app/tests/index.js index c8d65770..49381de6 100644 --- a/TestRunner/app/tests/index.js +++ b/TestRunner/app/tests/index.js @@ -192,6 +192,7 @@ require("./PerformanceTests"); // The ns:/node: builtin modules require("./NsUtilTests"); +require("./SwiftInteropTests"); // Node-API addon surface require("./NapiTests"); diff --git a/TestRunner/app/tests/swiftInteropWorker.js b/TestRunner/app/tests/swiftInteropWorker.js new file mode 100644 index 00000000..847323ca --- /dev/null +++ b/TestRunner/app/tests/swiftInteropWorker.js @@ -0,0 +1,24 @@ +// SwiftDemo from a worker isolate: calls work there, main-actor members are +// refused off the main thread, and async results and closures called from +// other threads come back to the worker. +var SwiftDemo = require("ns:swift/SwiftDemo"); +var result = { greeting: new SwiftDemo.Demo().greet("worker") }; +try { + new SwiftDemo.Palette(); + result.palette = "constructed"; +} catch (e) { + result.palette = e.message; +} +SwiftDemo.makeTrackerLater(5).then(function (tracker) { + result.trackerId = tracker.id; + return SwiftDemo.delayedEcho("from worker", 0.001); +}).then(function (text) { + result.echo = text; + SwiftDemo.greetLater("worker", function (greeting) { + result.callback = greeting; + postMessage(result); + }); +}, function (error) { + result.echo = "error: " + error.message; + postMessage(result); +}); diff --git a/build_metadata_generator.sh b/build_metadata_generator.sh index e7a84326..68ef246e 100755 --- a/build_metadata_generator.sh +++ b/build_metadata_generator.sh @@ -13,7 +13,8 @@ function build { mkdir build cmake -B build -DCMAKE_BUILD_TYPE=Release -DMETADATA_BINARY_ARCH=$1 -DCMAKE_OSX_ARCHITECTURES=$1 cmake --build build --target clean - cmake --build build -j$NUMJOBS + # The generator alone: the Swift interop tests do not ship. + cmake --build build -j$NUMJOBS --target objc-metadata-generator mkdir "dist/$1" cp -r "build/bin" "dist/$1" } diff --git a/docs/swift-interop.md b/docs/swift-interop.md new file mode 100644 index 00000000..0ff4bbe8 --- /dev/null +++ b/docs/swift-interop.md @@ -0,0 +1,203 @@ +# Swift interop + +The runtime can call pure Swift APIs — Swift classes, actors, structs and +enums that are not visible to Objective-C — through small Swift thunks the +metadata generator emits at build time. Objective-C-visible APIs keep using the +existing metadata path; this covers what that path cannot reach. + +```js +const { Demo, Point, Flavor } = require("ns:swift/SwiftDemo"); +// or: import { Demo, Point, Flavor } from "ns:swift/SwiftDemo"; +// or: require("ns:swift").module("SwiftDemo") + +const demo = new Demo(); +demo.greet("NativeScript"); // "Hello, NativeScript" +const point = new Point({ x: 2, y: 3 }); +point.x; // 2 +Flavor.vanilla; // "vanilla" +``` + +## How it fits together + +1. **Symbol graphs.** Compile the Swift module with `-emit-symbol-graph` (or run + `swift symbolgraph-extract`) to get `.symbols.json` and its + `@.symbols.json` extension graphs. +2. **Generation.** `objc-metadata-generator --swift-symbolgraph-dir ` + loads them into the Swift IR, classifies every declaration + (`--swift-coverage-output` reports the result) and can have the Swift + compiler confirm the classification (`--swift-verify`). From the verified + classification it writes: + - `--swift-thunk-output`: `+NativeScript.swift`, one thunk per + callable declaration plus a registration function; + - `-output-typescript`: `swift!.d.ts`, declaring exactly what the + thunks expose (`declare module "ns:swift/"`). +3. **Build.** Compile the thunk file in a module that imports `` and + link it into the app. It exports one C symbol, `ns_swift_register_`; + because nothing references it statically, link with + `-Wl,-u,_ns_swift_register_` and keep it in any exported-symbols + list. +4. **Runtime.** The first `ns:swift/` access looks the register + symbol up with `dlsym`, records the module's types and members, and builds + its JavaScript classes for the current isolate. + +`TestRunner` does all of this for the `SwiftDemo` fixture +(`metadata-generator/TestFixtures/SwiftDemo`): the `SwiftDemo` target compiles +the fixture sources together with the generated `Interop/` file, whose +contents the generator tests keep identical to the generator's output. The +fixture's `Package.swift` builds the same files as two SwiftPM modules. + +## Value model + +| Swift | JavaScript | +|---|---| +| `Bool` | `boolean` | +| `Int`, `Int8`…`Int64`, `UInt`…`UInt64` | `number` (or `BigInt` as input); values outside ±(2⁵³−1) throw `RangeError` rather than lose precision | +| `Float`, `Double`, `CGFloat` | `number` | +| `String` | `string` | +| `T?` | `T` or `null` (inputs also accept `undefined`) | +| class, actor | an instance of the generated JS class; one JS object per Swift object | +| struct | an instance of the generated JS class holding its own copy | +| enum without associated values | the case name as a string; the enum's namespace object (`Flavor.vanilla`) lists them | +| enum with associated values | a plain object copy naming its case: `{ case: "area", width: 3, height: 4 }` | +| `Date` | `Date` | +| `URL` | `URL` (inputs also accept a string) | +| `Data` | `Uint8Array` copy (inputs accept any `ArrayBuffer` or view) | +| `[T]` | array copy | +| `[String: T]` | plain object copy | +| `(A, B) -> Void` (parameters only) | `function (a, b)` | +| Objective-C class (`UIView`, an `NSObject` subclass) | NativeScript's ordinary Objective-C wrapper, with the identity Objective-C calls give it | + +Collections are copied in both directions; their elements follow the same +table (optional elements are not supported yet), and dictionary keys must be +`String`. + +An enum with associated values keys each value by its label; a case's only, +unlabeled value is `value` (`{ case: "length", value: 2 }`), and other +unlabeled values are keyed by position (`{ case: "sum", 0: a, 1: b }`). +TypeScript declares the enum as a union of its cases, so `switch (m.case)` +narrows. An enum is bridged only when every case's values are; recursive +(`indirect`) enums are. + +Thunks import the framework an Objective-C class most likely comes from +(`UIView` -> UIKit), guessed from its prefix since symbol graphs do not +record it; compiler verification drops declarations whose types still do not +resolve. TypeScript names these classes by their global `@nativescript/types` +name, and Swift classes without `@objc(Name)` as `NSObject`. Swift-only +members of Objective-C-visible Swift classes are not exposed yet. + +Structs have value semantics: reading a struct-typed property, passing a struct +argument, or returning one copies it, so a JS object never aliases another +copy. Mutating members and property setters change the copy the JS object +holds. + +## Calling conventions + +- Methods and functions take positional arguments. Overloads with the same + JavaScript name are resolved by argument count and by which overloads accept + the arguments' JS types. +- When more than one overload accepts the arguments (`scale(by: Double)` and + `scale(by: Int)` both accept a number), the call throws a `TypeError` naming + the overloads' keys; call one directly by key: `polygon["scale(by: Int)"](2)`. + Every overload is also reachable by its Swift name when that is unique + (`demo["greet(name:times:)"]("a", 2)`). +- Initializers run through `new` and also accept one object naming every + argument label: `new Point({ x: 2, y: 3 })`. A failable initializer that + returns `nil` throws. +- Subclass instances accept inherited overloads; JS classes follow the Swift + class hierarchy (`instanceof` works). +- Enum initializers are `Enum.init(...)`, returning a case or `null`. Enum + instance members are functions taking the case first: + `Flavor.description("vanilla")`, `Measurement.isNone({ case: "none" })`. +- An `inout` parameter takes a reference object: `bump(ref)` with + `ref = { value: 41 }` leaves `ref.value === 42`. The value is read before + the call and replaced after it succeeds; a throw leaves it unchanged. A + struct comes back as a new copy, so the object passed in is not mutated. + `async` functions with `inout` parameters are not exposed. +- Properties are accessors; read-only Swift properties have no setter. +- Nested types hang off their parent: `Polygon.Style.dashed`, + `new Polygon.Metrics({ perimeter: 3 })`. When the parent itself is not + bridged, a frozen namespace object stands in for it. + +## Closures + +A closure parameter that returns `Void` takes a JS function; its arguments +follow the value table. The Swift closure keeps the function alive for as long +as Swift holds the closure, and drops it when Swift releases the closure. + +- Called on the JS thread, the closure runs the function before returning. + That includes every call made while the Swift call is in progress + (`countdown(3, (n) => ...)`). When the function throws during the call, the + call throws that exception, and later invocations in the same call are + skipped. +- Called from any other thread (a completion handler run by a background + queue), the invocation is queued to the isolate's thread and Swift does not + wait for it. A throw there is reported as an uncaught error. +- Closures that return a value, throw, or are `async`, `@autoclosure` + parameters, closures with `inout` parameters, and closures returned from + Swift are not bridged yet. + +## Async, actors and the main actor + +- `async` functions return a Promise. The call reads its arguments + synchronously, runs in a Swift `Task`, and settles the Promise on the + calling isolate's thread (main or Worker); a `throw` rejects it with the + Swift error. If the isolate is gone by then, the outcome is dropped. +- Members of an `actor` are awaited from outside it, exactly as in Swift: + `await counter.increment()`, `await counter.value`. Actor properties are + never assignable from JavaScript. `nonisolated` members stay synchronous. +- `@MainActor` members run synchronously on the main thread. Called from a + Worker, they throw instead of trapping; their `async` members hop to the main + actor on their own and work from any isolate. +- `async` initializers are not exposed: `new` cannot await. + +## Errors + +- A Swift `throw` becomes a JS `Error` with `name === "SwiftError"`, + `message` set to `String(describing: error)` and `swiftType` set to the + error's type name. +- Arguments of the wrong type throw `TypeError`; out-of-range integers throw + `RangeError`. +- Calling a declaration that is newer than the running OS throws an `Error` + naming the required version. + +## Identity and lifetime + +A Swift object returned to JavaScript is retained once by its JS wrapper and +released when the wrapper is garbage collected; returning the same object again +yields the same wrapper. Wrappers belong to the isolate that created them, so +each worker gets its own JS objects. + +## Coverage and verification + +Every declaration gets one tier — `objc-direct`, `swift-generated`, +`swift-specialized`, `type-only`, `unsupported` or `not-applicable` — with +machine-readable reasons (`metadata-generator/src/Swift/CapabilityClassifier.h`). +`--swift-verify` type-checks a probe for every generated declaration, and the +generated thunks themselves, with the Swift compiler, demotes whatever it +rejects as `compiler-rejected:`, and repeats until everything that +remains compiles. Symbol graphs cannot +express every fact a call depends on (`~Copyable` is often invisible), so +verification is what makes the generated surface trustworthy at SDK scale. + +## Not yet supported + +Closures that return values, async cancellation, generics +(including `Result`), protocols as values, tuples, sets, optional collection +elements, subscripts and operators. Each appears in the coverage report with +its reason. + +## Swift language mode + +The thunks compile in Swift 5 and Swift 6 language modes. In Swift 6 mode, +code outside a module may not touch that module's nonisolated mutable globals +(`public var counter = 0`); run `--swift-verify` with the same mode +(`--swift-compiler "xcrun swiftc -swift-version 6"`) and those declarations +are demoted as `compiler-rejected`. + +## ABI + +`NativeScript/runtime/SwiftInterop.h` is the binary contract between the +runtime and generated thunks (value slots, the API table, kinds and signature +codes, and the async completion and callback entries). Thunks are stamped with +`NS_SWIFT_ABI_VERSION`; the runtime refuses a module generated for another +version. diff --git a/metadata-generator/.gitignore b/metadata-generator/.gitignore index 243173d3..d0487f90 100644 --- a/metadata-generator/.gitignore +++ b/metadata-generator/.gitignore @@ -207,3 +207,6 @@ test-results/ # CLion .idea + +# Snapshot test output written next to the expected file on a mismatch +*.actual diff --git a/metadata-generator/README.md b/metadata-generator/README.md index b0ee3f57..c55f658e 100644 --- a/metadata-generator/README.md +++ b/metadata-generator/README.md @@ -83,9 +83,8 @@ codes): | `unsupported` | not bridgeable yet; `reasons` say why | | `not-applicable` | not an API surface (deinitializers, macros) | -The generated surface currently bridges `Bool`, integer and floating-point -types, `String`, optionals of those, module classes and actors (handles), -module structs (boxed copies) and payload-less enums (case-name strings). +`docs/swift-interop.md` lists the Swift types and declaration kinds the +generated surface bridges, and how each looks from JavaScript. `--swift-coverage-output ` writes `.coverage.json`: counts per tier and kind, a histogram of reasons, and every symbol's classification. diff --git a/metadata-generator/TestFixtures/SwiftDemo/Interop/SwiftDemo+NativeScript.swift b/metadata-generator/TestFixtures/SwiftDemo/Interop/SwiftDemo+NativeScript.swift index 6a94315e..ea911c46 100644 --- a/metadata-generator/TestFixtures/SwiftDemo/Interop/SwiftDemo+NativeScript.swift +++ b/metadata-generator/TestFixtures/SwiftDemo/Interop/SwiftDemo+NativeScript.swift @@ -1,7 +1,10 @@ // Generated by objc-metadata-generator from the SwiftDemo symbol graphs. Do not edit. -// NativeScript Swift interop thunks, ABI 1: see NativeScript/runtime/SwiftInterop.h. +// NativeScript Swift interop thunks, ABI 7: see NativeScript/runtime/SwiftInterop.h. import Foundation import SwiftDemo +#if canImport(UIKit) +import UIKit +#endif private typealias __NSThunk = @convention(c) (UnsafeMutableRawPointer, UnsafeRawPointer?, Int) -> Void private typealias __NSRelease = @convention(c) (UnsafeMutableRawPointer) -> Void @@ -11,29 +14,101 @@ private final class __NSBox { init(_ value: Value) { self.value = value } } +// The result entries calls and completions share, so value reporting code +// serves both. +private protocol __NSReporter { + func returnVoid() + func returnBool(_ value: Bool) + func returnInt64(_ value: Int64) + func returnUInt64(_ value: UInt64) + func returnDouble(_ value: Double) + func returnString(_ value: String) + func returnNull() + func returnBytes(_ value: Data) + func returnArray(_ values: Elements, _ each: (Elements.Element) -> Void) + func returnMap(_ values: [String: Value], _ each: (String, Value) -> Void) + func returnObject(_ object: AnyObject, _ typeIndex: UInt32) + func returnCase(_ index: Int, _ values: () -> Void) + func returnObjC(_ object: AnyObject) +} + // Reads arguments (24-byte slots) and reports results through the runtime's // API table, whose address is the first word of the call context. -private struct __NSCall { +// 24-byte argument slots: tag at 0, payload at 8, length at 16. Arrays and +// maps point at their own slots (a map's are key, value, key, value, ...). +private struct __NSSlots { + let base: UnsafeRawPointer? + + func isNull(_ i: Int) -> Bool { base!.load(fromByteOffset: i * 24, as: UInt32.self) == 0 } + func bool(_ i: Int) -> Bool { base!.load(fromByteOffset: i * 24 + 8, as: UInt8.self) != 0 } + func int64(_ i: Int) -> Int64 { base!.load(fromByteOffset: i * 24 + 8, as: Int64.self) } + func uint64(_ i: Int) -> UInt64 { base!.load(fromByteOffset: i * 24 + 8, as: UInt64.self) } + func double(_ i: Int) -> Double { base!.load(fromByteOffset: i * 24 + 8, as: Double.self) } + private func buffer(_ i: Int) -> UnsafeBufferPointer { + let start = base!.load(fromByteOffset: i * 24 + 8, as: UnsafePointer?.self) + let length = Int(base!.load(fromByteOffset: i * 24 + 16, as: UInt64.self)) + return UnsafeBufferPointer(start: start, count: length) + } + func string(_ i: Int) -> String { String(decoding: buffer(i), as: UTF8.self) } + func bytes(_ i: Int) -> Data { Data(buffer(i)) } + func object(_ i: Int) -> AnyObject { + let pointer = base!.load(fromByteOffset: i * 24 + 8, as: UnsafeMutableRawPointer.self) + return Unmanaged.fromOpaque(pointer).takeUnretainedValue() + } + func callback(_ i: Int) -> UnsafeMutableRawPointer { + base!.load(fromByteOffset: i * 24 + 8, as: UnsafeMutableRawPointer.self) + } + func elements(_ i: Int) -> (__NSSlots, Int) { + let start = base!.load(fromByteOffset: i * 24 + 8, as: UnsafeRawPointer?.self) + return (__NSSlots(base: start), Int(base!.load(fromByteOffset: i * 24 + 16, as: UInt64.self))) + } +} + +// nil when an element does not convert. +private func __nsReadArray(_ slots: __NSSlots, _ i: Int, + _ read: (__NSSlots, Int) -> Element?) -> [Element]? { + let (elements, count) = slots.elements(i) + var result: [Element] = [] + result.reserveCapacity(count) + for j in 0..(_ slots: __NSSlots, _ i: Int, + _ read: (__NSSlots, Int) -> Value?) -> [String: Value]? { + let (entries, count) = slots.elements(i) + var result: [String: Value] = [:] + result.reserveCapacity(count) + for j in 0..(_ index: Int, _: Function.Type) -> Function { call.load(as: UnsafeRawPointer.self).load(fromByteOffset: index * 8, as: Function.self) } - func isNull(_ i: Int) -> Bool { args!.load(fromByteOffset: i * 24, as: UInt32.self) == 0 } - func bool(_ i: Int) -> Bool { args!.load(fromByteOffset: i * 24 + 8, as: UInt8.self) != 0 } - func int64(_ i: Int) -> Int64 { args!.load(fromByteOffset: i * 24 + 8, as: Int64.self) } - func uint64(_ i: Int) -> UInt64 { args!.load(fromByteOffset: i * 24 + 8, as: UInt64.self) } - func double(_ i: Int) -> Double { args!.load(fromByteOffset: i * 24 + 8, as: Double.self) } - func string(_ i: Int) -> String { - let base = args!.load(fromByteOffset: i * 24 + 8, as: UnsafePointer?.self) - let length = Int(args!.load(fromByteOffset: i * 24 + 16, as: UInt64.self)) - return String(decoding: UnsafeBufferPointer(start: base, count: length), as: UTF8.self) - } - func object(_ i: Int) -> AnyObject { - let pointer = args!.load(fromByteOffset: i * 24 + 8, as: UnsafeMutableRawPointer.self) - return Unmanaged.fromOpaque(pointer).takeUnretainedValue() + var api: UnsafeRawPointer { call.load(as: UnsafeRawPointer.self) } + func string(_ i: Int) -> String { slots.string(i) } + func object(_ i: Int) -> AnyObject { slots.object(i) } + + func beginAsync() -> __NSCompletion { + let token = slot(13, (@convention(c) (UnsafeMutableRawPointer) -> UnsafeMutableRawPointer).self)(call) + return __NSCompletion(api: call.load(as: UnsafeRawPointer.self), token: token) } func returnVoid() { @@ -61,10 +136,44 @@ private struct __NSCall { func returnNull() { slot(6, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(call) } + func returnBytes(_ value: Data) { + value.withUnsafeBytes { + slot(5, (@convention(c) (UnsafeMutableRawPointer, UnsafePointer?, Int) -> Void).self)( + call, $0.bindMemory(to: UInt8.self).baseAddress, $0.count) + } + } + // Each element is reported with the ordinary return* entries. + func returnArray(_ values: Elements, _ each: (Elements.Element) -> Void) { + slot(23, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(call, values.count) + for value in values { each(value) } + slot(24, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(call) + } + // `each` reports the key (a string), then the value. + func returnMap(_ values: [String: Value], _ each: (String, Value) -> Void) { + slot(25, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(call, values.count) + for (key, value) in values { each(key, value) } + slot(26, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(call) + } + // `values` reports the case's associated values in order. + func returnCase(_ index: Int, _ values: () -> Void) { + slot(34, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(call, index) + values() + slot(36, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(call) + } + // `value` reports the final value of inout argument `index`. + func writeBack(_ index: Int, _ value: () -> Void) { + slot(38, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(call, index) + value() + slot(39, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(call) + } func returnObject(_ object: AnyObject, _ typeIndex: UInt32) { slot(7, (@convention(c) (UnsafeMutableRawPointer, UnsafeMutableRawPointer, UInt32) -> Void).self)( call, Unmanaged.passRetained(object).toOpaque(), typeIndex) } + func returnObjC(_ object: AnyObject) { + slot(40, (@convention(c) (UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> Void).self)( + call, Unmanaged.passRetained(object).toOpaque()) + } func throwError(_ error: any Error) { report(String(describing: error), String(reflecting: type(of: error))) } @@ -91,11 +200,174 @@ private struct __NSCall { } } +// Carries values into a Task; the runtime only touches them on one thread at +// a time. +private final class __NSUnchecked: @unchecked Sendable { + let value: Value + init(_ value: Value) { self.value = value } +} + +// Settles an async call's Promise from any thread; the first report consumes +// the token. +private struct __NSCompletion: @unchecked Sendable, __NSReporter { + let api: UnsafeRawPointer + let token: UnsafeMutableRawPointer + + private func slot(_ index: Int, _: Function.Type) -> Function { + api.load(fromByteOffset: index * 8, as: Function.self) + } + + func returnVoid() { + slot(14, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(token) + } + func returnBool(_ value: Bool) { + slot(15, (@convention(c) (UnsafeMutableRawPointer, UInt8) -> Void).self)(token, value ? 1 : 0) + } + func returnInt64(_ value: Int64) { + slot(16, (@convention(c) (UnsafeMutableRawPointer, Int64) -> Void).self)(token, value) + } + func returnUInt64(_ value: UInt64) { + slot(17, (@convention(c) (UnsafeMutableRawPointer, UInt64) -> Void).self)(token, value) + } + func returnDouble(_ value: Double) { + slot(18, (@convention(c) (UnsafeMutableRawPointer, Double) -> Void).self)(token, value) + } + func returnString(_ value: String) { + var value = value + value.withUTF8 { + slot(19, (@convention(c) (UnsafeMutableRawPointer, UnsafePointer?, Int) -> Void).self)( + token, $0.baseAddress, $0.count) + } + } + func returnNull() { + slot(20, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(token) + } + func returnBytes(_ value: Data) { + value.withUnsafeBytes { + slot(19, (@convention(c) (UnsafeMutableRawPointer, UnsafePointer?, Int) -> Void).self)( + token, $0.bindMemory(to: UInt8.self).baseAddress, $0.count) + } + } + func returnArray(_ values: Elements, _ each: (Elements.Element) -> Void) { + slot(27, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(token, values.count) + for value in values { each(value) } + slot(28, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(token) + } + func returnMap(_ values: [String: Value], _ each: (String, Value) -> Void) { + slot(29, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(token, values.count) + for (key, value) in values { each(key, value) } + slot(30, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(token) + } + func returnCase(_ index: Int, _ values: () -> Void) { + slot(35, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(token, index) + values() + slot(37, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(token) + } + func returnObject(_ object: AnyObject, _ typeIndex: UInt32) { + slot(21, (@convention(c) (UnsafeMutableRawPointer, UnsafeMutableRawPointer, UInt32) -> Void).self)( + token, Unmanaged.passRetained(object).toOpaque(), typeIndex) + } + func returnObjC(_ object: AnyObject) { + slot(41, (@convention(c) (UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> Void).self)( + token, Unmanaged.passRetained(object).toOpaque()) + } + func throwError(_ error: any Error) { + var message = String(describing: error) + var type = String(reflecting: Swift.type(of: error)) + message.withUTF8 { messageBytes in + type.withUTF8 { typeBytes in + slot(22, (@convention(c) (UnsafeMutableRawPointer, UnsafePointer?, Int, + UnsafePointer?, Int) -> Void).self)( + token, messageBytes.baseAddress, messageBytes.count, typeBytes.baseAddress, typeBytes.count) + } + } + } +} + +// A JS function held as a Swift closure. Calls may come from any thread; the +// runtime runs the function on its isolate's thread. +private final class __NSCallback: @unchecked Sendable { + let api: UnsafeRawPointer + let handle: UnsafeMutableRawPointer + + init(api: UnsafeRawPointer, handle: UnsafeMutableRawPointer) { + self.api = api + self.handle = handle + api.load(fromByteOffset: 32 * 8, as: (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(handle) + } + + deinit { + api.load(fromByteOffset: 33 * 8, as: (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(handle) + } + + // `arguments` reports each argument through the ordinary return entries. + func invoke(_ arguments: (__NSCompletion) -> Void) { + let begin = api.load(fromByteOffset: 31 * 8, + as: (@convention(c) (UnsafeMutableRawPointer) -> UnsafeMutableRawPointer).self) + let completion = __NSCompletion(api: api, token: begin(handle)) + arguments(completion) + api.load(fromByteOffset: 28 * 8, as: (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(completion.token) + } +} + private func __nsRelease(_ object: UnsafeMutableRawPointer) { Unmanaged.fromOpaque(object).release() } -private func __nsEnum1(_ name: String) -> SwiftDemo.Precipitation? { +// s:9SwiftDemo10ShapeErrorO +private func __nsReadCase1(_ slots: __NSSlots, _ i: Int) -> SwiftDemo.ShapeError? { + let (s, _) = slots.elements(i) + switch s.int64(0) { + case 0: + let e0 = s.double(1) + return SwiftDemo.ShapeError.`invalidSide`(e0) + case 1: + let e0 = Int(truncatingIfNeeded: s.int64(1)) + let e1 = Int(truncatingIfNeeded: s.int64(2)) + return SwiftDemo.ShapeError.`tooManySides`(count: e0, limit: e1) + case 2: + return SwiftDemo.ShapeError.`unknown` + default: return nil + } +} + +private func __nsReportCase1(_ r: R, _ value: SwiftDemo.ShapeError) { + switch value { + case let SwiftDemo.ShapeError.`invalidSide`(p0): r.returnCase(0) { r.returnDouble(Double(p0)) } + case let SwiftDemo.ShapeError.`tooManySides`(p0, p1): r.returnCase(1) { r.returnInt64(Int64(p0)); r.returnInt64(Int64(p1)) } + case SwiftDemo.ShapeError.`unknown`: r.returnCase(2) { } + @unknown default: r.returnNull() + } +} + +// s:9SwiftDemo11MeasurementO +private func __nsReadCase2(_ slots: __NSSlots, _ i: Int) -> SwiftDemo.Measurement? { + let (s, _) = slots.elements(i) + switch s.int64(0) { + case 0: + let e0 = s.double(1) + let e1 = s.double(2) + return SwiftDemo.Measurement.`area`(width: e0, height: e1) + case 1: + return SwiftDemo.Measurement.`none` + case 2: + let e0 = s.double(1) + return SwiftDemo.Measurement.`length`(e0) + default: return nil + } +} + +private func __nsReportCase2(_ r: R, _ value: SwiftDemo.Measurement) { + switch value { + case let SwiftDemo.Measurement.`area`(p0, p1): r.returnCase(0) { r.returnDouble(Double(p0)); r.returnDouble(Double(p1)) } + case SwiftDemo.Measurement.`none`: r.returnCase(1) { } + case let SwiftDemo.Measurement.`length`(p0): r.returnCase(2) { r.returnDouble(Double(p0)) } + @unknown default: r.returnNull() + } +} + +// s:9SwiftDemo13PrecipitationO +private func __nsEnum4(_ name: String) -> SwiftDemo.Precipitation? { switch name { case "rain": return SwiftDemo.Precipitation.`rain` case "snow": return SwiftDemo.Precipitation.`snow` @@ -104,7 +376,7 @@ private func __nsEnum1(_ name: String) -> SwiftDemo.Precipitation? { } } -private func __nsEnumName1(_ value: SwiftDemo.Precipitation) -> String { +private func __nsEnumName4(_ value: SwiftDemo.Precipitation) -> String { switch value { case SwiftDemo.Precipitation.`rain`: return "rain" case SwiftDemo.Precipitation.`snow`: return "snow" @@ -113,7 +385,8 @@ private func __nsEnumName1(_ value: SwiftDemo.Precipitation) -> String { } } -private func __nsEnum5(_ name: String) -> SwiftDemo.Flavor? { +// s:9SwiftDemo6FlavorO +private func __nsEnum9(_ name: String) -> SwiftDemo.Flavor? { switch name { case "vanilla": return SwiftDemo.Flavor.`vanilla` case "chocolate": return SwiftDemo.Flavor.`chocolate` @@ -121,7 +394,7 @@ private func __nsEnum5(_ name: String) -> SwiftDemo.Flavor? { } } -private func __nsEnumName5(_ value: SwiftDemo.Flavor) -> String { +private func __nsEnumName9(_ value: SwiftDemo.Flavor) -> String { switch value { case SwiftDemo.Flavor.`vanilla`: return "vanilla" case SwiftDemo.Flavor.`chocolate`: return "chocolate" @@ -129,8 +402,86 @@ private func __nsEnumName5(_ value: SwiftDemo.Flavor) -> String { } } +// s:9SwiftDemo7FormulaO +private func __nsReadCase13(_ slots: __NSSlots, _ i: Int) -> SwiftDemo.Formula? { + let (s, _) = slots.elements(i) + switch s.int64(0) { + case 0: + guard let e0 = __nsReadCase13(s, 1) else { return nil } + guard let e1 = __nsReadCase13(s, 2) else { return nil } + return SwiftDemo.Formula.`sum`(e0, e1) + case 1: + guard let e0 = __nsReadCase13(s, 1) else { return nil } + return SwiftDemo.Formula.`negate`(e0) + case 2: + let e0 = s.double(1) + return SwiftDemo.Formula.`number`(e0) + default: return nil + } +} + +private func __nsReportCase13(_ r: R, _ value: SwiftDemo.Formula) { + switch value { + case let SwiftDemo.Formula.`sum`(p0, p1): r.returnCase(0) { __nsReportCase13(r, p0); __nsReportCase13(r, p1) } + case let SwiftDemo.Formula.`negate`(p0): r.returnCase(1) { __nsReportCase13(r, p0) } + case let SwiftDemo.Formula.`number`(p0): r.returnCase(2) { r.returnDouble(Double(p0)) } + @unknown default: r.returnNull() + } +} + +// s:9SwiftDemo7PayloadO +private func __nsReadCase15(_ slots: __NSSlots, _ i: Int) -> SwiftDemo.Payload? { + let (s, _) = slots.elements(i) + switch s.int64(0) { + case 0: + let e0: Int? = s.isNull(1) ? nil : Int(truncatingIfNeeded: s.int64(1)) + return SwiftDemo.Payload.`maybe`(e0) + case 1: + guard let e0 = __nsReadArray(s, 1, { (s: __NSSlots, j: Int) -> String? in s.string(j) }) else { return nil } + return SwiftDemo.Payload.`names`(e0) + case 2: + guard let e0 = (s.object(1) as? __NSBox)?.value else { return nil } + return SwiftDemo.Payload.`point`(e0) + case 3: + guard let e0 = __nsEnum9(s.string(1)) else { return nil } + return SwiftDemo.Payload.`flavor`(e0) + case 4: + guard let e0 = s.object(1) as? SwiftDemo.Tracker else { return nil } + return SwiftDemo.Payload.`tracker`(e0) + default: return nil + } +} + +private func __nsReportCase15(_ r: R, _ value: SwiftDemo.Payload) { + switch value { + case let SwiftDemo.Payload.`maybe`(p0): r.returnCase(0) { if let p0 { r.returnInt64(Int64(p0)) } else { r.returnNull() } } + case let SwiftDemo.Payload.`names`(p0): r.returnCase(1) { r.returnArray(p0) { element in r.returnString(element) } } + case let SwiftDemo.Payload.`point`(p0): r.returnCase(2) { r.returnObject(__NSBox(p0), 7) } + case let SwiftDemo.Payload.`flavor`(p0): r.returnCase(3) { r.returnString(__nsEnumName9(p0)) } + case let SwiftDemo.Payload.`tracker`(p0): r.returnCase(4) { r.returnObject(p0, __nsTypeIndex(p0, 19)) } + @unknown default: r.returnNull() + } +} + +// s:9SwiftDemo7PolygonC5StyleO +private func __nsEnum17(_ name: String) -> SwiftDemo.Polygon.Style? { + switch name { + case "solid": return SwiftDemo.Polygon.Style.`solid` + case "dashed": return SwiftDemo.Polygon.Style.`dashed` + default: return nil + } +} + +private func __nsEnumName17(_ value: SwiftDemo.Polygon.Style) -> String { + switch value { + case SwiftDemo.Polygon.Style.`solid`: return "solid" + case SwiftDemo.Polygon.Style.`dashed`: return "dashed" + @unknown default: return String(describing: value) + } +} + private func __nsTypeIndex(_ object: AnyObject, _ declared: UInt32) -> UInt32 { - if object is SwiftDemo.Square { return 7 } + if object is SwiftDemo.Square { return 11 } return declared } @@ -138,8 +489,8 @@ private func __nsTypeIndex(_ object: AnyObject, _ declared: UInt32) -> UInt32 { private func __nsThunk0(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Demo else { return rt.throwTypeError("receiver must be SwiftDemo.Demo") } - let a0 = rt.string(1) - let a1 = Int(truncatingIfNeeded: rt.int64(2)) + let a0 = rt.slots.string(1) + let a1 = Int(truncatingIfNeeded: rt.slots.int64(2)) let result: String = receiver.`greet`(name: a0, times: a1) rt.returnString(result) } @@ -148,7 +499,7 @@ private func __nsThunk0(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointe private func __nsThunk1(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Demo else { return rt.throwTypeError("receiver must be SwiftDemo.Demo") } - let a0 = rt.string(1) + let a0 = rt.slots.string(1) let result: String = receiver.`greet`(name: a0) rt.returnString(result) } @@ -167,25 +518,95 @@ private func __nsThunk3(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointe rt.returnObject(result, __nsTypeIndex(result, 0)) } -// s:9SwiftDemo10echoUInt64ys0D0VADF +// s:9SwiftDemo10allFlavorsSayAA6FlavorOGyF private func __nsThunk4(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = rt.uint64(0) + let result: [SwiftDemo.Flavor] = SwiftDemo.`allFlavors`() + rt.returnArray(result) { element in rt.returnString(__nsEnumName9(element)) } +} + +// s:9SwiftDemo10echoUInt64ys0D0VADF +private func __nsThunk5(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.uint64(0) let result: UInt64 = SwiftDemo.`echoUInt64`(a0) rt.returnUInt64(UInt64(result)) } +// s:9SwiftDemo10greetLater_10completionySSSg_yADYbctF +private func __nsThunk6(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.isNull(0) ? nil : rt.slots.string(0) + let a1 = { () -> @Sendable (String?) -> Void in let callback = __NSCallback(api: rt.api, handle: rt.slots.callback(1)); return { (p0: String?) in callback.invoke { r in if let p0 { r.returnString(p0) } else { r.returnNull() } } } }() + let _: Void = SwiftDemo.`greetLater`(a0, completion: a1) + rt.returnVoid() +} + // s:9SwiftDemo10largestIntSiyF -private func __nsThunk5(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk7(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) let result: Int = SwiftDemo.`largestInt`() rt.returnInt64(Int64(result)) } +// s:9SwiftDemo10namesLaterySaySSGSiYaF +private func __nsThunk8(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = Int(truncatingIfNeeded: rt.slots.int64(0)) + let completion = rt.beginAsync() + let captured = __NSUnchecked(a0) + Task { + let a0 = captured.value + let result: [String] = await SwiftDemo.`namesLater`(a0) + completion.returnArray(result) { element in completion.returnString(element) } + } +} + +// s:9SwiftDemo10wordCountsySDySSSiGSaySSGF +private func __nsThunk9(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = __nsReadArray(rt.slots, 0, { (s: __NSSlots, j: Int) -> String? in s.string(j) }) else { return rt.throwTypeError("argument 1 must be an array of String") } + let result: [String: Int] = SwiftDemo.`wordCounts`(a0) + rt.returnMap(result) { key, element in rt.returnString(key); rt.returnInt64(Int64(element)) } +} + +// s:9SwiftDemo11MeasurementO4UnitV6symbolAESS_tcfc +private func __nsThunk10(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.string(0) + let result: SwiftDemo.Measurement.Unit = SwiftDemo.Measurement.Unit(symbol: a0) + rt.returnObject(__NSBox(result), 3) +} + +// s:9SwiftDemo11MeasurementO4UnitV6symbolSSvp +private func __nsThunk11(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Measurement.Unit") } + let result: String = box.value.`symbol` + rt.returnString(result) +} + +// s:9SwiftDemo11MeasurementO4UnitV6symbolSSvp (setter) +private func __nsThunk12(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Measurement.Unit") } + let newValue = rt.slots.string(1) + box.value.`symbol` = newValue + rt.returnVoid() +} + +// s:9SwiftDemo11MeasurementO6isNoneSbvp +private func __nsThunk13(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = __nsReadCase2(rt.slots, 0) else { return rt.throwTypeError("receiver must be SwiftDemo.Measurement") } + let result: Bool = receiver.`isNone` + rt.returnBool(result) +} + // s:9SwiftDemo11checkedSideyS2dKF -private func __nsThunk6(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk14(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = rt.double(0) + let a0 = rt.slots.double(0) do { let result: Double = try SwiftDemo.`checkedSide`(a0) rt.returnDouble(Double(result)) @@ -194,135 +615,298 @@ private func __nsThunk6(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointe } } +// s:9SwiftDemo11delayedEcho_5afterS2S_SdtYaKF +private func __nsThunk15(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.string(0) + let a1 = rt.slots.double(1) + let completion = rt.beginAsync() + let captured = __NSUnchecked((a0, a1)) + Task { + let (a0, a1) = captured.value + do { + let result: String = try await SwiftDemo.`delayedEcho`(a0, after: a1) + completion.returnString(result) + } catch { + completion.throwError(error) + } + } +} + +// s:9SwiftDemo12firstSubview2ofSo6UIViewCSgAE_tF +private func __nsThunk16(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = rt.slots.object(0) as? UIView else { return rt.throwTypeError("argument 1 must be a UIView") } + let result: UIView? = SwiftDemo.`firstSubview`(of: a0) + if let result { + rt.returnObjC(result) + } else { + rt.returnNull() + } +} + +// s:9SwiftDemo12measureLateryAA11MeasurementOSdYaF +private func __nsThunk17(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.double(0) + let completion = rt.beginAsync() + let captured = __NSUnchecked(a0) + Task { + let a0 = captured.value + let result: SwiftDemo.Measurement = await SwiftDemo.`measureLater`(a0) + __nsReportCase2(completion, result) + } +} + +// s:9SwiftDemo12measurementsSayAA11MeasurementOGyF +private func __nsThunk18(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let result: [SwiftDemo.Measurement] = SwiftDemo.`measurements`() + rt.returnArray(result) { element in __nsReportCase2(rt, element) } +} + +// s:9SwiftDemo12swapTrackersyyAA7TrackerCz_ADztF +private func __nsThunk19(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let v0 = rt.slots.object(0) as? SwiftDemo.Tracker else { return rt.throwTypeError("argument 1 must be SwiftDemo.Tracker") } + var a0 = v0 + guard let v1 = rt.slots.object(1) as? SwiftDemo.Tracker else { return rt.throwTypeError("argument 2 must be SwiftDemo.Tracker") } + var a1 = v1 + let _: Void = SwiftDemo.`swapTrackers`(&a0, &a1) + rt.writeBack(0) { rt.returnObject(a0, __nsTypeIndex(a0, 19)) } + rt.writeBack(1) { rt.returnObject(a1, __nsTypeIndex(a1, 19)) } + rt.returnVoid() +} + // s:9SwiftDemo13PrecipitationO8rawValueACSgSS_tcfc -private func __nsThunk7(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk20(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = rt.string(0) + let a0 = rt.slots.string(0) let result: SwiftDemo.Precipitation? = SwiftDemo.Precipitation(rawValue: a0) if let result { - rt.returnString(__nsEnumName1(result)) + rt.returnString(__nsEnumName4(result)) } else { rt.returnNull() } } // s:9SwiftDemo13defaultFlavorAA0D0Ovp -private func __nsThunk8(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk21(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) let result: SwiftDemo.Flavor = SwiftDemo.`defaultFlavor` - rt.returnString(__nsEnumName5(result)) + rt.returnString(__nsEnumName9(result)) } // s:9SwiftDemo13globalCounterSivp -private func __nsThunk9(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk22(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) let result: Int = SwiftDemo.`globalCounter` rt.returnInt64(Int64(result)) } // s:9SwiftDemo13globalCounterSivp (setter) -private func __nsThunk10(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk23(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let newValue = Int(truncatingIfNeeded: rt.int64(0)) + let newValue = Int(truncatingIfNeeded: rt.slots.int64(0)) SwiftDemo.`globalCounter` = newValue rt.returnVoid() } // s:9SwiftDemo16makeDefaultPointAA0E0VyF -private func __nsThunk11(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk24(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) let result: SwiftDemo.Point = SwiftDemo.`makeDefaultPoint`() - rt.returnObject(__NSBox(result), 3) + rt.returnObject(__NSBox(result), 7) +} + +// s:9SwiftDemo16makeTrackerLater2idAA0D0CSi_tYaF +private func __nsThunk25(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = Int(truncatingIfNeeded: rt.slots.int64(0)) + let completion = rt.beginAsync() + let captured = __NSUnchecked(a0) + Task { + let a0 = captured.value + let result: SwiftDemo.Tracker = await SwiftDemo.`makeTrackerLater`(id: a0) + completion.returnObject(result, __nsTypeIndex(result, 19)) + } +} + +// s:9SwiftDemo3JobO6TicketV2idAESi_tcfc +private func __nsThunk26(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = Int(truncatingIfNeeded: rt.slots.int64(0)) + let result: SwiftDemo.Job.Ticket = SwiftDemo.Job.Ticket(id: a0) + rt.returnObject(__NSBox(result), 5) +} + +// s:9SwiftDemo3JobO6TicketV2idSivp +private func __nsThunk27(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Job.Ticket") } + let result: Int = box.value.`id` + rt.returnInt64(Int64(result)) +} + +// s:9SwiftDemo3JobO6TicketV2idSivp (setter) +private func __nsThunk28(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Job.Ticket") } + let newValue = Int(truncatingIfNeeded: rt.slots.int64(1)) + box.value.`id` = newValue + rt.returnVoid() } // s:9SwiftDemo4RingV5inner5outerAcA5PointV_AGtcfc -private func __nsThunk12(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk29(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - guard let a0 = (rt.object(0) as? __NSBox)?.value else { return rt.throwTypeError("argument 1 must be SwiftDemo.Point") } - guard let a1 = (rt.object(1) as? __NSBox)?.value else { return rt.throwTypeError("argument 2 must be SwiftDemo.Point") } + guard let a0 = (rt.slots.object(0) as? __NSBox)?.value else { return rt.throwTypeError("argument 1 must be SwiftDemo.Point") } + guard let a1 = (rt.slots.object(1) as? __NSBox)?.value else { return rt.throwTypeError("argument 2 must be SwiftDemo.Point") } let result: SwiftDemo.Ring = SwiftDemo.Ring(inner: a0, outer: a1) - rt.returnObject(__NSBox(result), 2) + rt.returnObject(__NSBox(result), 6) } // s:9SwiftDemo4RingV5innerAA5PointVvp -private func __nsThunk13(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk30(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Ring") } let result: SwiftDemo.Point = box.value.`inner` - rt.returnObject(__NSBox(result), 3) + rt.returnObject(__NSBox(result), 7) } // s:9SwiftDemo4RingV5innerAA5PointVvp (setter) -private func __nsThunk14(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk31(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Ring") } - guard let newValue = (rt.object(1) as? __NSBox)?.value else { return rt.throwTypeError("value must be SwiftDemo.Point") } + guard let newValue = (rt.slots.object(1) as? __NSBox)?.value else { return rt.throwTypeError("value must be SwiftDemo.Point") } box.value.`inner` = newValue rt.returnVoid() } // s:9SwiftDemo4RingV5outerAA5PointVvp -private func __nsThunk15(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk32(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Ring") } let result: SwiftDemo.Point = box.value.`outer` - rt.returnObject(__NSBox(result), 3) + rt.returnObject(__NSBox(result), 7) } // s:9SwiftDemo4RingV5outerAA5PointVvp (setter) -private func __nsThunk16(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk33(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Ring") } - guard let newValue = (rt.object(1) as? __NSBox)?.value else { return rt.throwTypeError("value must be SwiftDemo.Point") } + guard let newValue = (rt.slots.object(1) as? __NSBox)?.value else { return rt.throwTypeError("value must be SwiftDemo.Point") } box.value.`outer` = newValue rt.returnVoid() } // s:9SwiftDemo4RingV6expand2byySd_tF -private func __nsThunk17(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk34(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Ring") } - let a0 = rt.double(1) + let a0 = rt.slots.double(1) let _: Void = box.value.`expand`(by: a0) rt.returnVoid() } -// s:9SwiftDemo5PointV11descriptionSSvp -private func __nsThunk18(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +// s:9SwiftDemo4area2ofSdAA11MeasurementO_tF +private func __nsThunk35(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Point") } - let result: String = box.value.`description` - rt.returnString(result) + guard let a0 = __nsReadCase2(rt.slots, 0) else { return rt.throwTypeError("argument 1 must be a case of SwiftDemo.Measurement") } + let result: Double = SwiftDemo.`area`(of: a0) + rt.returnDouble(Double(result)) } -// s:9SwiftDemo5PointV1x1yACSd_Sdtcfc -private func __nsThunk19(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +// s:9SwiftDemo4bumpyySizF +private func __nsThunk36(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = rt.double(0) - let a1 = rt.double(1) - let result: SwiftDemo.Point = SwiftDemo.Point(x: a0, y: a1) - rt.returnObject(__NSBox(result), 3) + let v0 = Int(truncatingIfNeeded: rt.slots.int64(0)) + var a0 = v0 + let _: Void = SwiftDemo.`bump`(&a0) + rt.writeBack(0) { rt.returnInt64(Int64(a0)) } + rt.returnVoid() } -// s:9SwiftDemo5PointV1xSdvp -private func __nsThunk20(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +// s:9SwiftDemo4echoyAA7PayloadOADF +private func __nsThunk37(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Point") } - let result: Double = box.value.`x` - rt.returnDouble(Double(result)) + guard let a0 = __nsReadCase15(rt.slots, 0) else { return rt.throwTypeError("argument 1 must be a case of SwiftDemo.Payload") } + let result: SwiftDemo.Payload = SwiftDemo.`echo`(a0) + __nsReportCase15(rt, result) } -// s:9SwiftDemo5PointV1xSdvp (setter) -private func __nsThunk21(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +// s:9SwiftDemo4host2ofSSSg10Foundation3URLV_tF +private func __nsThunk38(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = URL(string: rt.slots.string(0)) else { return rt.throwTypeError("argument 1 must be a valid URL") } + let result: String? = SwiftDemo.`host`(of: a0) + if let result { + rt.returnString(result) + } else { + rt.returnNull() + } +} + +// s:9SwiftDemo4rampy10Foundation4DataVSiF +private func __nsThunk39(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = Int(truncatingIfNeeded: rt.slots.int64(0)) + let result: Data = SwiftDemo.`ramp`(a0) + rt.returnBytes(result) +} + +// s:9SwiftDemo4tagsySaySiGSaySo6UIViewCGF +private func __nsThunk40(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = __nsReadArray(rt.slots, 0, { (s: __NSSlots, j: Int) -> UIView? in s.object(j) as? UIView }) else { return rt.throwTypeError("argument 1 must be an array of a UIView") } + let result: [Int] = SwiftDemo.`tags`(a0) + rt.returnArray(result) { element in rt.returnInt64(Int64(element)) } +} + +// s:9SwiftDemo4text2ofSSAA4NoteC_tF +private func __nsThunk41(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = rt.slots.object(0) as? SwiftDemo.Note else { return rt.throwTypeError("argument 1 must be a SwiftDemo.Note") } + let result: String = SwiftDemo.`text`(of: a0) + rt.returnString(result) +} + +// s:9SwiftDemo5PointV11descriptionSSvp +private func __nsThunk42(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Point") } + let result: String = box.value.`description` + rt.returnString(result) +} + +// s:9SwiftDemo5PointV1x1yACSd_Sdtcfc +private func __nsThunk43(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.double(0) + let a1 = rt.slots.double(1) + let result: SwiftDemo.Point = SwiftDemo.Point(x: a0, y: a1) + rt.returnObject(__NSBox(result), 7) +} + +// s:9SwiftDemo5PointV1xSdvp +private func __nsThunk44(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Point") } - let newValue = rt.double(1) + let result: Double = box.value.`x` + rt.returnDouble(Double(result)) +} + +// s:9SwiftDemo5PointV1xSdvp (setter) +private func __nsThunk45(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Point") } + let newValue = rt.slots.double(1) box.value.`x` = newValue rt.returnVoid() } // s:9SwiftDemo5PointV1ySdvp -private func __nsThunk22(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk46(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Point") } let result: Double = box.value.`y` @@ -330,26 +914,58 @@ private func __nsThunk22(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPoint } // s:9SwiftDemo5PointV1ySdvp (setter) -private func __nsThunk23(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk47(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Point") } - let newValue = rt.double(1) + let newValue = rt.slots.double(1) box.value.`y` = newValue rt.returnVoid() } // s:9SwiftDemo5PointV6lengthSdvp -private func __nsThunk24(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk48(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Point") } let result: Double = box.value.`length` rt.returnDouble(Double(result)) } +// s:9SwiftDemo5clearyySSSgzF +private func __nsThunk49(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let v0 = rt.slots.isNull(0) ? nil : rt.slots.string(0) + var a0 = v0 + let _: Void = SwiftDemo.`clear`(&a0) + rt.writeBack(0) { if let a0 { rt.returnString(a0) } else { rt.returnNull() } } + rt.returnVoid() +} + +// s:9SwiftDemo5halveyySizKF +private func __nsThunk50(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let v0 = Int(truncatingIfNeeded: rt.slots.int64(0)) + var a0 = v0 + do { + let _: Void = try SwiftDemo.`halve`(&a0) + rt.writeBack(0) { rt.returnInt64(Int64(a0)) } + rt.returnVoid() + } catch { + rt.throwError(error) + } +} + +// s:9SwiftDemo5namesySaySSGSiF +private func __nsThunk51(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = Int(truncatingIfNeeded: rt.slots.int64(0)) + let result: [String] = SwiftDemo.`names`(a0) + rt.returnArray(result) { element in rt.returnString(element) } +} + // s:9SwiftDemo5shoutySSSgACF -private func __nsThunk25(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk52(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = rt.isNull(0) ? nil : rt.string(0) + let a0 = rt.slots.isNull(0) ? nil : rt.slots.string(0) let result: String? = SwiftDemo.`shout`(a0) if let result { rt.returnString(result) @@ -358,28 +974,46 @@ private func __nsThunk25(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPoint } } +// s:9SwiftDemo5totalySdSaySdGF +private func __nsThunk53(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = __nsReadArray(rt.slots, 0, { (s: __NSSlots, j: Int) -> Double? in s.double(j) }) else { return rt.throwTypeError("argument 1 must be an array of Double") } + let result: Double = SwiftDemo.`total`(a0) + rt.returnDouble(Double(result)) +} + +// s:9SwiftDemo6CanvasCACycfc +private func __nsThunk54(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard Thread.isMainThread else { return rt.throwMessage("init() is isolated to the main actor; call it on the main thread") } + MainActor.assumeIsolated { + let result: SwiftDemo.Canvas = SwiftDemo.Canvas() + rt.returnObject(result, __nsTypeIndex(result, 8)) + } +} + // s:9SwiftDemo6FlavorO11descriptionSSvp -private func __nsThunk26(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk55(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - guard let receiver = __nsEnum5(rt.string(0)) else { return rt.throwTypeError("receiver must be SwiftDemo.Flavor") } + guard let receiver = __nsEnum9(rt.string(0)) else { return rt.throwTypeError("receiver must be SwiftDemo.Flavor") } let result: String = receiver.`description` rt.returnString(result) } // s:9SwiftDemo6FlavorO8rawValueACSgSi_tcfc -private func __nsThunk27(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk56(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = Int(truncatingIfNeeded: rt.int64(0)) + let a0 = Int(truncatingIfNeeded: rt.slots.int64(0)) let result: SwiftDemo.Flavor? = SwiftDemo.Flavor(rawValue: a0) if let result { - rt.returnString(__nsEnumName5(result)) + rt.returnString(__nsEnumName9(result)) } else { rt.returnNull() } } // s:9SwiftDemo6LoaderC10modernOnlyyyF -private func __nsThunk28(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk57(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard #available(iOS 16.0, *) else { return rt.throwMessage("modernOnly() requires iOS 16.0") } guard let receiver = rt.object(0) as? SwiftDemo.Loader else { return rt.throwTypeError("receiver must be SwiftDemo.Loader") } @@ -388,15 +1022,94 @@ private func __nsThunk28(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPoint } // s:9SwiftDemo6LoaderC11legacyFetchyyF -private func __nsThunk29(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk58(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Loader else { return rt.throwTypeError("receiver must be SwiftDemo.Loader") } let _: Void = receiver.`legacyFetch`() rt.returnVoid() } +// s:9SwiftDemo6LoaderC4eachyyySiXEF +private func __nsThunk59(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Loader else { return rt.throwTypeError("receiver must be SwiftDemo.Loader") } + let a0 = { () -> (Int) -> Void in let callback = __NSCallback(api: rt.api, handle: rt.slots.callback(1)); return { (p0: Int) in callback.invoke { r in r.returnInt64(Int64(p0)) } } }() + let _: Void = receiver.`each`(a0) + rt.returnVoid() +} + +// s:9SwiftDemo6LoaderC4load4path10Foundation4DataVSS_tKF +private func __nsThunk60(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Loader else { return rt.throwTypeError("receiver must be SwiftDemo.Loader") } + let a0 = rt.slots.string(1) + do { + let result: Data = try receiver.`load`(path: a0) + rt.returnBytes(result) + } catch { + rt.throwError(error) + } +} + +// s:9SwiftDemo6LoaderC4wait7secondsySd_tYaF +private func __nsThunk61(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Loader else { return rt.throwTypeError("receiver must be SwiftDemo.Loader") } + let a0 = rt.slots.double(1) + let completion = rt.beginAsync() + let captured = __NSUnchecked((receiver, a0)) + Task { + let (receiver, a0) = captured.value + let _: Void = await receiver.`wait`(seconds: a0) + completion.returnVoid() + } +} + +// s:9SwiftDemo6LoaderC5fetch3urlSS10Foundation3URLV_tYaKF +private func __nsThunk62(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Loader else { return rt.throwTypeError("receiver must be SwiftDemo.Loader") } + guard let a0 = URL(string: rt.slots.string(1)) else { return rt.throwTypeError("argument 1 must be a valid URL") } + let completion = rt.beginAsync() + let captured = __NSUnchecked((receiver, a0)) + Task { + let (receiver, a0) = captured.value + do { + let result: String = try await receiver.`fetch`(url: a0) + completion.returnString(result) + } catch { + completion.throwError(error) + } + } +} + +// s:9SwiftDemo6LoaderC6lookup5table3keySiSgSDySSSiG_SStF +private func __nsThunk63(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Loader else { return rt.throwTypeError("receiver must be SwiftDemo.Loader") } + guard let a0 = __nsReadMap(rt.slots, 1, { (s: __NSSlots, j: Int) -> Int? in Int(truncatingIfNeeded: s.int64(j)) }) else { return rt.throwTypeError("argument 1 must be an object whose values are Int") } + let a1 = rt.slots.string(2) + let result: Int? = receiver.`lookup`(table: a0, key: a1) + if let result { + rt.returnInt64(Int64(result)) + } else { + rt.returnNull() + } +} + +// s:9SwiftDemo6LoaderC6updateyyAA5PointVzF +private func __nsThunk64(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Loader else { return rt.throwTypeError("receiver must be SwiftDemo.Loader") } + guard let v0 = (rt.slots.object(1) as? __NSBox)?.value else { return rt.throwTypeError("argument 1 must be SwiftDemo.Point") } + var a0 = v0 + let _: Void = receiver.`update`(&a0) + rt.writeBack(0) { rt.returnObject(__NSBox(a0), 7) } + rt.returnVoid() +} + // s:9SwiftDemo6LoaderC8oldFetchyyF -private func __nsThunk30(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk65(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Loader else { return rt.throwTypeError("receiver must be SwiftDemo.Loader") } let _: Void = receiver.`oldFetch`() @@ -404,14 +1117,14 @@ private func __nsThunk30(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPoint } // s:9SwiftDemo6LoaderCACycfc -private func __nsThunk31(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk66(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) let result: SwiftDemo.Loader = SwiftDemo.Loader() - rt.returnObject(result, __nsTypeIndex(result, 6)) + rt.returnObject(result, __nsTypeIndex(result, 10)) } // s:9SwiftDemo6SquareC4areaSdvp -private func __nsThunk32(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk67(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Square else { return rt.throwTypeError("receiver must be SwiftDemo.Square") } let result: Double = receiver.`area` @@ -419,15 +1132,15 @@ private func __nsThunk32(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPoint } // s:9SwiftDemo6SquareC4sideACSd_tcfc -private func __nsThunk33(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk68(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = rt.double(0) + let a0 = rt.slots.double(0) let result: SwiftDemo.Square = SwiftDemo.Square(side: a0) - rt.returnObject(result, __nsTypeIndex(result, 7)) + rt.returnObject(result, __nsTypeIndex(result, 11)) } // s:9SwiftDemo6SquareC4sideSdvp -private func __nsThunk34(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk69(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Square else { return rt.throwTypeError("receiver must be SwiftDemo.Square") } let result: Double = receiver.`side` @@ -435,56 +1148,159 @@ private func __nsThunk34(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPoint } // s:9SwiftDemo6SquareC4sideSdvp (setter) -private func __nsThunk35(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk70(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Square else { return rt.throwTypeError("receiver must be SwiftDemo.Square") } - let newValue = rt.double(1) + let newValue = rt.slots.double(1) receiver.`side` = newValue rt.returnVoid() } // s:9SwiftDemo6SquareC5greet4nameS2S_tF -private func __nsThunk36(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk71(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Square else { return rt.throwTypeError("receiver must be SwiftDemo.Square") } - let a0 = rt.string(1) + let a0 = rt.slots.string(1) let result: String = receiver.`greet`(name: a0) rt.returnString(result) } // s:9SwiftDemo6SquareC5scale2byySd_tF -private func __nsThunk37(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk72(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Square else { return rt.throwTypeError("receiver must be SwiftDemo.Square") } - let a0 = rt.double(1) + let a0 = rt.slots.double(1) let _: Void = receiver.`scale`(by: a0) rt.returnVoid() } // s:9SwiftDemo6SquareC5sidesSivpZ -private func __nsThunk38(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk73(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) let result: Int = SwiftDemo.Square.`sides` rt.returnInt64(Int64(result)) } +// s:9SwiftDemo6append_2toySS_SaySSGztF +private func __nsThunk74(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.string(0) + guard let v1 = __nsReadArray(rt.slots, 1, { (s: __NSSlots, j: Int) -> String? in s.string(j) }) else { return rt.throwTypeError("argument 2 must be an array of String") } + var a1 = v1 + let _: Void = SwiftDemo.`append`(a0, to: &a1) + rt.writeBack(1) { rt.returnArray(a1) { element in rt.returnString(element) } } + rt.returnVoid() +} + +// s:9SwiftDemo7CounterC4stepSivp +private func __nsThunk75(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Counter else { return rt.throwTypeError("receiver must be SwiftDemo.Counter") } + let completion = rt.beginAsync() + let captured = __NSUnchecked(receiver) + Task { + let receiver = captured.value + let result: Int = await receiver.`step` + completion.returnInt64(Int64(result)) + } +} + // s:9SwiftDemo7CounterC5labelSSyF -private func __nsThunk39(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk76(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Counter else { return rt.throwTypeError("receiver must be SwiftDemo.Counter") } let result: String = receiver.`label`() rt.returnString(result) } +// s:9SwiftDemo7CounterC5valueSivp +private func __nsThunk77(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Counter else { return rt.throwTypeError("receiver must be SwiftDemo.Counter") } + let completion = rt.beginAsync() + let captured = __NSUnchecked(receiver) + Task { + let receiver = captured.value + let result: Int = await receiver.`value` + completion.returnInt64(Int64(result)) + } +} + +// s:9SwiftDemo7CounterC9incrementSiyF +private func __nsThunk78(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Counter else { return rt.throwTypeError("receiver must be SwiftDemo.Counter") } + let completion = rt.beginAsync() + let captured = __NSUnchecked(receiver) + Task { + let receiver = captured.value + let result: Int = await receiver.`increment`() + completion.returnInt64(Int64(result)) + } +} + // s:9SwiftDemo7CounterCACycfc -private func __nsThunk40(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk79(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) let result: SwiftDemo.Counter = SwiftDemo.Counter() - rt.returnObject(result, __nsTypeIndex(result, 8)) + rt.returnObject(result, __nsTypeIndex(result, 12)) +} + +// s:9SwiftDemo7FormulaO5valueSdvp +private func __nsThunk80(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = __nsReadCase13(rt.slots, 0) else { return rt.throwTypeError("receiver must be SwiftDemo.Formula") } + let result: Double = receiver.`value` + rt.returnDouble(Double(result)) +} + +// s:9SwiftDemo7PaletteC11strokeLaterSiyYaF +private func __nsThunk81(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Palette else { return rt.throwTypeError("receiver must be SwiftDemo.Palette") } + let completion = rt.beginAsync() + let captured = __NSUnchecked(receiver) + Task { + let receiver = captured.value + let result: Int = await receiver.`strokeLater`() + completion.returnInt64(Int64(result)) + } +} + +// s:9SwiftDemo7PaletteC6strokeSiyF +private func __nsThunk82(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Palette else { return rt.throwTypeError("receiver must be SwiftDemo.Palette") } + guard Thread.isMainThread else { return rt.throwMessage("stroke() is isolated to the main actor; call it on the main thread") } + MainActor.assumeIsolated { + let result: Int = receiver.`stroke`() + rt.returnInt64(Int64(result)) + } +} + +// s:9SwiftDemo7PaletteC7strokesSivp +private func __nsThunk83(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Palette else { return rt.throwTypeError("receiver must be SwiftDemo.Palette") } + guard Thread.isMainThread else { return rt.throwMessage("strokes is isolated to the main actor; call it on the main thread") } + MainActor.assumeIsolated { + let result: Int = receiver.`strokes` + rt.returnInt64(Int64(result)) + } +} + +// s:9SwiftDemo7PaletteCACycfc +private func __nsThunk84(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard Thread.isMainThread else { return rt.throwMessage("init() is isolated to the main actor; call it on the main thread") } + MainActor.assumeIsolated { + let result: SwiftDemo.Palette = SwiftDemo.Palette() + rt.returnObject(result, __nsTypeIndex(result, 14)) + } } // s:9SwiftDemo7PolygonC11vertexCountSivp -private func __nsThunk41(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk85(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Polygon else { return rt.throwTypeError("receiver must be SwiftDemo.Polygon") } let result: Int = receiver.`vertexCount` @@ -492,82 +1308,136 @@ private func __nsThunk41(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPoint } // s:9SwiftDemo7PolygonC4makeACyFZ -private func __nsThunk42(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk86(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) let result: SwiftDemo.Polygon = SwiftDemo.Polygon.`make`() - rt.returnObject(result, __nsTypeIndex(result, 9)) + rt.returnObject(result, __nsTypeIndex(result, 16)) } // s:9SwiftDemo7PolygonC4name11vertexCountACSS_Sitcfc -private func __nsThunk43(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk87(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = rt.string(0) - let a1 = Int(truncatingIfNeeded: rt.int64(1)) + let a0 = rt.slots.string(0) + let a1 = Int(truncatingIfNeeded: rt.slots.int64(1)) let result: SwiftDemo.Polygon = SwiftDemo.Polygon(name: a0, vertexCount: a1) - rt.returnObject(result, __nsTypeIndex(result, 9)) + rt.returnObject(result, __nsTypeIndex(result, 16)) } // s:9SwiftDemo7PolygonC4nameACSgSS_tcfc -private func __nsThunk44(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk88(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = rt.string(0) + let a0 = rt.slots.string(0) let result: SwiftDemo.Polygon? = SwiftDemo.Polygon(name: a0) if let result { - rt.returnObject(result, __nsTypeIndex(result, 9)) + rt.returnObject(result, __nsTypeIndex(result, 16)) } else { rt.returnNull() } } // s:9SwiftDemo7PolygonC4nameSSvp -private func __nsThunk45(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk89(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Polygon else { return rt.throwTypeError("receiver must be SwiftDemo.Polygon") } let result: String = receiver.`name` rt.returnString(result) } +// s:9SwiftDemo7PolygonC5StyleO8rawValueAESgSS_tcfc +private func __nsThunk90(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.string(0) + let result: SwiftDemo.Polygon.Style? = SwiftDemo.Polygon.Style(rawValue: a0) + if let result { + rt.returnString(__nsEnumName17(result)) + } else { + rt.returnNull() + } +} + // s:9SwiftDemo7PolygonC5scale1x1yySd_SdtF -private func __nsThunk46(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk91(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Polygon else { return rt.throwTypeError("receiver must be SwiftDemo.Polygon") } - let a0 = rt.double(1) - let a1 = rt.double(2) + let a0 = rt.slots.double(1) + let a1 = rt.slots.double(2) let _: Void = receiver.`scale`(x: a0, y: a1) rt.returnVoid() } // s:9SwiftDemo7PolygonC5scale2byySd_tF -private func __nsThunk47(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk92(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Polygon else { return rt.throwTypeError("receiver must be SwiftDemo.Polygon") } - let a0 = rt.double(1) + let a0 = rt.slots.double(1) let _: Void = receiver.`scale`(by: a0) rt.returnVoid() } // s:9SwiftDemo7PolygonC5scale2byySi_tF -private func __nsThunk48(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk93(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Polygon else { return rt.throwTypeError("receiver must be SwiftDemo.Polygon") } - let a0 = Int(truncatingIfNeeded: rt.int64(1)) + let a0 = Int(truncatingIfNeeded: rt.slots.int64(1)) let _: Void = receiver.`scale`(by: a0) rt.returnVoid() } +// s:9SwiftDemo7PolygonC5styleAC5StyleOvp +private func __nsThunk94(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Polygon else { return rt.throwTypeError("receiver must be SwiftDemo.Polygon") } + let result: SwiftDemo.Polygon.Style = receiver.`style` + rt.returnString(__nsEnumName17(result)) +} + // s:9SwiftDemo7PolygonC6sharedACvpZ -private func __nsThunk49(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk95(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) let result: SwiftDemo.Polygon = SwiftDemo.Polygon.`shared` - rt.returnObject(result, __nsTypeIndex(result, 9)) + rt.returnObject(result, __nsTypeIndex(result, 16)) +} + +// s:9SwiftDemo7PolygonC7MetricsV9perimeterAESd_tcfc +private func __nsThunk96(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.double(0) + let result: SwiftDemo.Polygon.Metrics = SwiftDemo.Polygon.Metrics(perimeter: a0) + rt.returnObject(__NSBox(result), 18) +} + +// s:9SwiftDemo7PolygonC7MetricsV9perimeterSdvp +private func __nsThunk97(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Polygon.Metrics") } + let result: Double = box.value.`perimeter` + rt.returnDouble(Double(result)) +} + +// s:9SwiftDemo7PolygonC7MetricsV9perimeterSdvp (setter) +private func __nsThunk98(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let box = rt.object(0) as? __NSBox else { return rt.throwTypeError("receiver must be SwiftDemo.Polygon.Metrics") } + let newValue = rt.slots.double(1) + box.value.`perimeter` = newValue + rt.returnVoid() +} + +// s:9SwiftDemo7PolygonC7metrics4sideAC7MetricsVSd_tF +private func __nsThunk99(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Polygon else { return rt.throwTypeError("receiver must be SwiftDemo.Polygon") } + let a0 = rt.slots.double(1) + let result: SwiftDemo.Polygon.Metrics = receiver.`metrics`(side: a0) + rt.returnObject(__NSBox(result), 18) } // s:9SwiftDemo7PolygonC8describeySSACSgFZ -private func __nsThunk50(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk100(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) var a0: SwiftDemo.Polygon? = nil - if !rt.isNull(0) { - guard let value = rt.object(0) as? SwiftDemo.Polygon else { return rt.throwTypeError("argument 1 must be SwiftDemo.Polygon") } + if !rt.slots.isNull(0) { + guard let value = rt.slots.object(0) as? SwiftDemo.Polygon else { return rt.throwTypeError("argument 1 must be SwiftDemo.Polygon") } a0 = value } let result: String = SwiftDemo.Polygon.`describe`(a0) @@ -575,15 +1445,15 @@ private func __nsThunk50(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPoint } // s:9SwiftDemo7TrackerC2idACSi_tcfc -private func __nsThunk51(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk101(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = Int(truncatingIfNeeded: rt.int64(0)) + let a0 = Int(truncatingIfNeeded: rt.slots.int64(0)) let result: SwiftDemo.Tracker = SwiftDemo.Tracker(id: a0) - rt.returnObject(result, __nsTypeIndex(result, 10)) + rt.returnObject(result, __nsTypeIndex(result, 19)) } // s:9SwiftDemo7TrackerC2idSivp -private func __nsThunk52(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk102(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Tracker else { return rt.throwTypeError("receiver must be SwiftDemo.Tracker") } let result: Int = receiver.`id` @@ -591,44 +1461,249 @@ private func __nsThunk52(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPoint } // s:9SwiftDemo7TrackerC4sameACyF -private func __nsThunk53(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk103(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) guard let receiver = rt.object(0) as? SwiftDemo.Tracker else { return rt.throwTypeError("receiver must be SwiftDemo.Tracker") } let result: SwiftDemo.Tracker = receiver.`same`() - rt.returnObject(result, __nsTypeIndex(result, 10)) + rt.returnObject(result, __nsTypeIndex(result, 19)) } // s:9SwiftDemo7TrackerC9liveCountSivpZ -private func __nsThunk54(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk104(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) let result: Int = SwiftDemo.Tracker.`liveCount` rt.returnInt64(Int64(result)) } +// s:9SwiftDemo7explainySSAA10ShapeErrorOF +private func __nsThunk105(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = __nsReadCase1(rt.slots, 0) else { return rt.throwTypeError("argument 1 must be a case of SwiftDemo.ShapeError") } + let result: String = SwiftDemo.`explain`(a0) + rt.returnString(result) +} + +// s:9SwiftDemo7lengthsySDySSSiGSDyS2SGF +private func __nsThunk106(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = __nsReadMap(rt.slots, 0, { (s: __NSSlots, j: Int) -> String? in s.string(j) }) else { return rt.throwTypeError("argument 1 must be an object whose values are String") } + let result: [String: Int] = SwiftDemo.`lengths`(a0) + rt.returnMap(result) { key, element in rt.returnString(key); rt.returnInt64(Int64(element)) } +} + +// s:9SwiftDemo7measure_2byAA11MeasurementOSd_SdSgtF +private func __nsThunk107(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.double(0) + let a1 = rt.slots.isNull(1) ? nil : rt.slots.double(1) + let result: SwiftDemo.Measurement = SwiftDemo.`measure`(a0, by: a1) + __nsReportCase2(rt, result) +} + +// s:9SwiftDemo7nextDay5after10Foundation4DateVAF_tF +private func __nsThunk108(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = Date(timeIntervalSince1970: rt.slots.double(0) / 1000) + let result: Date = SwiftDemo.`nextDay`(after: a0) + rt.returnDouble(result.timeIntervalSince1970 * 1000) +} + +// s:9SwiftDemo7resolve_7against10Foundation3URLVSS_AFtF +private func __nsThunk109(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.string(0) + guard let a1 = URL(string: rt.slots.string(1)) else { return rt.throwTypeError("argument 2 must be a valid URL") } + let result: URL = SwiftDemo.`resolve`(a0, against: a1) + rt.returnString(result.absoluteString) +} + +// s:9SwiftDemo8NotifierC12publishLateryySSF +private func __nsThunk110(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Notifier else { return rt.throwTypeError("receiver must be SwiftDemo.Notifier") } + let a0 = rt.slots.string(1) + let _: Void = receiver.`publishLater`(a0) + rt.returnVoid() +} + +// s:9SwiftDemo8NotifierC5clearyyF +private func __nsThunk111(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Notifier else { return rt.throwTypeError("receiver must be SwiftDemo.Notifier") } + let _: Void = receiver.`clear`() + rt.returnVoid() +} + +// s:9SwiftDemo8NotifierC5countSivp +private func __nsThunk112(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Notifier else { return rt.throwTypeError("receiver must be SwiftDemo.Notifier") } + let result: Int = receiver.`count` + rt.returnInt64(Int64(result)) +} + +// s:9SwiftDemo8NotifierC7publishyySSF +private func __nsThunk113(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Notifier else { return rt.throwTypeError("receiver must be SwiftDemo.Notifier") } + let a0 = rt.slots.string(1) + let _: Void = receiver.`publish`(a0) + rt.returnVoid() +} + +// s:9SwiftDemo8NotifierC9subscribeyyySSYbcF +private func __nsThunk114(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = rt.object(0) as? SwiftDemo.Notifier else { return rt.throwTypeError("receiver must be SwiftDemo.Notifier") } + let a0 = { () -> @Sendable (String) -> Void in let callback = __NSCallback(api: rt.api, handle: rt.slots.callback(1)); return { (p0: String) in callback.invoke { r in r.returnString(p0) } } }() + let _: Void = receiver.`subscribe`(a0) + rt.returnVoid() +} + +// s:9SwiftDemo8NotifierCACycfc +private func __nsThunk115(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let result: SwiftDemo.Notifier = SwiftDemo.Notifier() + rt.returnObject(result, __nsTypeIndex(result, 20)) +} + +// s:9SwiftDemo8centroid2ofAA5PointVSayAEG_tF +private func __nsThunk116(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = __nsReadArray(rt.slots, 0, { (s: __NSSlots, j: Int) -> SwiftDemo.Point? in (s.object(j) as? __NSBox)?.value }) else { return rt.throwTypeError("argument 1 must be an array of SwiftDemo.Point") } + let result: SwiftDemo.Point = SwiftDemo.`centroid`(of: a0) + rt.returnObject(__NSBox(result), 7) +} + +// s:9SwiftDemo8checksumySi10Foundation4DataVF +private func __nsThunk117(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.bytes(0) + let result: Int = SwiftDemo.`checksum`(a0) + rt.returnInt64(Int64(result)) +} + +// s:9SwiftDemo8describeySSSo6UIViewCF +private func __nsThunk118(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = rt.slots.object(0) as? UIView else { return rt.throwTypeError("argument 1 must be a UIView") } + let result: String = SwiftDemo.`describe`(a0) + rt.returnString(result) +} + // s:9SwiftDemo8echoInt8ys0D0VADF -private func __nsThunk55(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk119(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - let a0 = Int8(truncatingIfNeeded: rt.int64(0)) + let a0 = Int8(truncatingIfNeeded: rt.slots.int64(0)) let result: Int8 = SwiftDemo.`echoInt8`(a0) rt.returnInt64(Int64(result)) } +// s:9SwiftDemo8makeNoteyAA0D0CSSF +private func __nsThunk120(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.string(0) + let result: SwiftDemo.Note = SwiftDemo.`makeNote`(a0) + rt.returnObjC(result) +} + +// s:9SwiftDemo8mirroredySaySaySiGGADF +private func __nsThunk121(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = __nsReadArray(rt.slots, 0, { (s: __NSSlots, j: Int) -> [Int]? in __nsReadArray(s, j, { (s: __NSSlots, j: Int) -> Int? in Int(truncatingIfNeeded: s.int64(j)) }) }) else { return rt.throwTypeError("argument 1 must be an array of an array of Int") } + let result: [[Int]] = SwiftDemo.`mirrored`(a0) + rt.returnArray(result) { element in rt.returnArray(element) { element in rt.returnInt64(Int64(element)) } } +} + +// s:9SwiftDemo8simplifyyAA7FormulaOADF +private func __nsThunk122(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = __nsReadCase13(rt.slots, 0) else { return rt.throwTypeError("argument 1 must be a case of SwiftDemo.Formula") } + let result: SwiftDemo.Formula = SwiftDemo.`simplify`(a0) + __nsReportCase13(rt, result) +} + +// s:9SwiftDemo8trackersySayAA7TrackerCGSaySiGF +private func __nsThunk123(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let a0 = __nsReadArray(rt.slots, 0, { (s: __NSSlots, j: Int) -> Int? in Int(truncatingIfNeeded: s.int64(j)) }) else { return rt.throwTypeError("argument 1 must be an array of Int") } + let result: [SwiftDemo.Tracker] = SwiftDemo.`trackers`(a0) + rt.returnArray(result) { element in rt.returnObject(element, __nsTypeIndex(element, 19)) } +} + +// s:9SwiftDemo9countdown4from_ySi_ySi_SbtXEtF +private func __nsThunk124(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = Int(truncatingIfNeeded: rt.slots.int64(0)) + let a1 = { () -> (Int, Bool) -> Void in let callback = __NSCallback(api: rt.api, handle: rt.slots.callback(1)); return { (p0: Int, p1: Bool) in callback.invoke { r in r.returnInt64(Int64(p0)); r.returnBool(p1) } } }() + let _: Void = SwiftDemo.`countdown`(from: a0, a1) + rt.returnVoid() +} + +// s:9SwiftDemo9makeLabelySo7UILabelCSSF +private func __nsThunk125(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.string(0) + guard Thread.isMainThread else { return rt.throwMessage("makeLabel(_:) is isolated to the main actor; call it on the main thread") } + MainActor.assumeIsolated { + let result: UILabel = SwiftDemo.`makeLabel`(a0) + rt.returnObjC(result) + } +} + +// s:9SwiftDemo9noteLateryAA4NoteCSSYaF +private func __nsThunk126(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = rt.slots.string(0) + let completion = rt.beginAsync() + let captured = __NSUnchecked(a0) + Task { + let a0 = captured.value + let result: SwiftDemo.Note = await SwiftDemo.`noteLater`(a0) + completion.returnObjC(result) + } +} + +// s:9SwiftDemo9onMeasureyyyAA11MeasurementOXEF +private func __nsThunk127(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + let a0 = { () -> (SwiftDemo.Measurement) -> Void in let callback = __NSCallback(api: rt.api, handle: rt.slots.callback(0)); return { (p0: SwiftDemo.Measurement) in callback.invoke { r in __nsReportCase2(r, p0) } } }() + let _: Void = SwiftDemo.`onMeasure`(a0) + rt.returnVoid() +} + // s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO -private func __nsThunk56(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk128(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - guard let receiver = __nsEnum1(rt.string(0)) else { return rt.throwTypeError("receiver must be SwiftDemo.Precipitation") } + guard let receiver = __nsEnum4(rt.string(0)) else { return rt.throwTypeError("receiver must be SwiftDemo.Precipitation") } let result: Int = receiver.`hashValue` rt.returnInt64(Int64(result)) } // s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo6FlavorO -private func __nsThunk57(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { +private func __nsThunk129(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { let rt = __NSCall(call: call, args: args) - guard let receiver = __nsEnum5(rt.string(0)) else { return rt.throwTypeError("receiver must be SwiftDemo.Flavor") } + guard let receiver = __nsEnum9(rt.string(0)) else { return rt.throwTypeError("receiver must be SwiftDemo.Flavor") } let result: Int = receiver.`hashValue` rt.returnInt64(Int64(result)) } +// s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO +private func __nsThunk130(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = __nsEnum17(rt.string(0)) else { return rt.throwTypeError("receiver must be SwiftDemo.Polygon.Style") } + let result: Int = receiver.`hashValue` + rt.returnInt64(Int64(result)) +} + +// s:s5ErrorP10FoundationE20localizedDescriptionSSvp::SYNTHESIZED::s:9SwiftDemo10ShapeErrorO +private func __nsThunk131(_ call: UnsafeMutableRawPointer, _ args: UnsafeRawPointer?, _ count: Int) { + let rt = __NSCall(call: call, args: args) + guard let receiver = __nsReadCase1(rt.slots, 0) else { return rt.throwTypeError("receiver must be SwiftDemo.ShapeError") } + let result: String = receiver.`localizedDescription` + rt.returnString(result) +} + #if hasAttribute(c) @c(ns_swift_register_SwiftDemo) #else @@ -640,73 +1715,170 @@ public func __nsRegister_SwiftDemo(_ registrar: UnsafeMutableRawPointer) { let registerType = api.load(fromByteOffset: 88, as: (@convention(c) (UnsafeMutableRawPointer, UInt32, UInt32, UnsafePointer, UnsafePointer, Int32) -> Void).self) let registerMember = api.load(fromByteOffset: 96, as: (@convention(c) (UnsafeMutableRawPointer, Int32, UInt32, UInt32, UnsafePointer, UnsafePointer, UnsafePointer, __NSThunk?, __NSThunk?) -> Void).self) - registerModule(registrar, 1, "SwiftDemo", "619ecd8bdf28f35a", __nsRelease) + registerModule(registrar, 7, "SwiftDemo", "40e57783a9253a14", __nsRelease) registerType(registrar, 0, 0, "Demo", "SwiftDemo.Demo", -1) - registerType(registrar, 1, 3, "Precipitation", "SwiftDemo.Precipitation", -1) - registerType(registrar, 2, 2, "Ring", "SwiftDemo.Ring", -1) - registerType(registrar, 3, 2, "Point", "SwiftDemo.Point", -1) - registerType(registrar, 4, 0, "Canvas", "SwiftDemo.Canvas", -1) - registerType(registrar, 5, 3, "Flavor", "SwiftDemo.Flavor", -1) - registerType(registrar, 6, 0, "Loader", "SwiftDemo.Loader", -1) - registerType(registrar, 7, 0, "Square", "SwiftDemo.Square", 9) - registerType(registrar, 8, 1, "Counter", "SwiftDemo.Counter", -1) - registerType(registrar, 9, 0, "Polygon", "SwiftDemo.Polygon", -1) - registerType(registrar, 10, 0, "Tracker", "SwiftDemo.Tracker", -1) + registerType(registrar, 1, 4, "ShapeError", "SwiftDemo.ShapeError", -1) + registerType(registrar, 2, 4, "Measurement", "SwiftDemo.Measurement", -1) + registerType(registrar, 3, 2, "Measurement.Unit", "SwiftDemo.Measurement.Unit", -1) + registerType(registrar, 4, 3, "Precipitation", "SwiftDemo.Precipitation", -1) + registerType(registrar, 5, 2, "Job.Ticket", "SwiftDemo.Job.Ticket", -1) + registerType(registrar, 6, 2, "Ring", "SwiftDemo.Ring", -1) + registerType(registrar, 7, 2, "Point", "SwiftDemo.Point", -1) + registerType(registrar, 8, 0, "Canvas", "SwiftDemo.Canvas", -1) + registerType(registrar, 9, 3, "Flavor", "SwiftDemo.Flavor", -1) + registerType(registrar, 10, 0, "Loader", "SwiftDemo.Loader", -1) + registerType(registrar, 11, 0, "Square", "SwiftDemo.Square", 16) + registerType(registrar, 12, 1, "Counter", "SwiftDemo.Counter", -1) + registerType(registrar, 13, 4, "Formula", "SwiftDemo.Formula", -1) + registerType(registrar, 14, 0, "Palette", "SwiftDemo.Palette", -1) + registerType(registrar, 15, 4, "Payload", "SwiftDemo.Payload", -1) + registerType(registrar, 16, 0, "Polygon", "SwiftDemo.Polygon", -1) + registerType(registrar, 17, 3, "Polygon.Style", "SwiftDemo.Polygon.Style", -1) + registerType(registrar, 18, 2, "Polygon.Metrics", "SwiftDemo.Polygon.Metrics", -1) + registerType(registrar, 19, 0, "Tracker", "SwiftDemo.Tracker", -1) + registerType(registrar, 20, 0, "Notifier", "SwiftDemo.Notifier", -1) registerMember(registrar, 0, 1, 0, "greet", "greet(name:times:)", "s,i64>s", __nsThunk0, nil) registerMember(registrar, 0, 1, 0, "greet", "greet(name:)", "s>s", __nsThunk1, nil) registerMember(registrar, 0, 4, 0, "version", "version", ">s", __nsThunk2, nil) registerMember(registrar, 0, 0, 0, "constructor", "init()", ">o0", __nsThunk3, nil) - registerMember(registrar, -1, 5, 0, "echoUInt64", "echoUInt64(_:)", "u64>u64", __nsThunk4, nil) - registerMember(registrar, -1, 5, 0, "largestInt", "largestInt()", ">i64", __nsThunk5, nil) - registerMember(registrar, -1, 5, 1, "checkedSide", "checkedSide(_:)", "f64>f64", __nsThunk6, nil) - registerMember(registrar, 1, 7, 0, "none", "none", ">e1", nil, nil) - registerMember(registrar, 1, 7, 0, "rain", "rain", ">e1", nil, nil) - registerMember(registrar, 1, 7, 0, "snow", "snow", ">e1", nil, nil) - registerMember(registrar, 1, 0, 0, "constructor", "init(rawValue:)", "s>e1?", __nsThunk7, nil) - registerMember(registrar, -1, 6, 0, "defaultFlavor", "defaultFlavor", ">e5", __nsThunk8, nil) - registerMember(registrar, -1, 6, 2, "globalCounter", "globalCounter", ">i64", __nsThunk9, __nsThunk10) - registerMember(registrar, -1, 5, 0, "makeDefaultPoint", "makeDefaultPoint()", ">o3", __nsThunk11, nil) - registerMember(registrar, 2, 0, 0, "constructor", "init(inner:outer:)", "o3,o3>o2", __nsThunk12, nil) - registerMember(registrar, 2, 3, 2, "inner", "inner", ">o3", __nsThunk13, __nsThunk14) - registerMember(registrar, 2, 3, 2, "outer", "outer", ">o3", __nsThunk15, __nsThunk16) - registerMember(registrar, 2, 1, 0, "expand", "expand(by:)", "f64>v", __nsThunk17, nil) - registerMember(registrar, 3, 3, 0, "description", "description", ">s", __nsThunk18, nil) - registerMember(registrar, 3, 0, 0, "constructor", "init(x:y:)", "f64,f64>o3", __nsThunk19, nil) - registerMember(registrar, 3, 3, 2, "x", "x", ">f64", __nsThunk20, __nsThunk21) - registerMember(registrar, 3, 3, 2, "y", "y", ">f64", __nsThunk22, __nsThunk23) - registerMember(registrar, 3, 3, 0, "length", "length", ">f64", __nsThunk24, nil) - registerMember(registrar, -1, 5, 0, "shout", "shout(_:)", "s?>s?", __nsThunk25, nil) - registerMember(registrar, 5, 3, 0, "description", "description", ">s", __nsThunk26, nil) - registerMember(registrar, 5, 7, 0, "vanilla", "vanilla", ">e5", nil, nil) - registerMember(registrar, 5, 0, 0, "constructor", "init(rawValue:)", "i64>e5?", __nsThunk27, nil) - registerMember(registrar, 5, 7, 0, "chocolate", "chocolate", ">e5", nil, nil) - registerMember(registrar, 6, 1, 0, "modernOnly", "modernOnly()", ">v", __nsThunk28, nil) - registerMember(registrar, 6, 1, 0, "legacyFetch", "legacyFetch()", ">v", __nsThunk29, nil) - registerMember(registrar, 6, 1, 0, "oldFetch", "oldFetch()", ">v", __nsThunk30, nil) - registerMember(registrar, 6, 0, 0, "constructor", "init()", ">o6", __nsThunk31, nil) - registerMember(registrar, 7, 3, 0, "area", "area", ">f64", __nsThunk32, nil) - registerMember(registrar, 7, 0, 0, "constructor", "init(side:)", "f64>o7", __nsThunk33, nil) - registerMember(registrar, 7, 3, 2, "side", "side", ">f64", __nsThunk34, __nsThunk35) - registerMember(registrar, 7, 1, 0, "greet", "greet(name:)", "s>s", __nsThunk36, nil) - registerMember(registrar, 7, 1, 0, "scale", "scale(by:)", "f64>v", __nsThunk37, nil) - registerMember(registrar, 7, 4, 0, "sides", "sides", ">i64", __nsThunk38, nil) - registerMember(registrar, 8, 1, 0, "label", "label()", ">s", __nsThunk39, nil) - registerMember(registrar, 8, 0, 0, "constructor", "init()", ">o8", __nsThunk40, nil) - registerMember(registrar, 9, 3, 0, "vertexCount", "vertexCount", ">i64", __nsThunk41, nil) - registerMember(registrar, 9, 2, 0, "make", "make()", ">o9", __nsThunk42, nil) - registerMember(registrar, 9, 0, 0, "constructor", "init(name:vertexCount:)", "s,i64>o9", __nsThunk43, nil) - registerMember(registrar, 9, 0, 0, "constructor", "init(name:)", "s>o9?", __nsThunk44, nil) - registerMember(registrar, 9, 3, 0, "name", "name", ">s", __nsThunk45, nil) - registerMember(registrar, 9, 1, 0, "scale", "scale(x:y:)", "f64,f64>v", __nsThunk46, nil) - registerMember(registrar, 9, 1, 4, "scale", "scale(by:)", "f64>v", __nsThunk47, nil) - registerMember(registrar, 9, 1, 4, "scale", "scale(by:)", "i64>v", __nsThunk48, nil) - registerMember(registrar, 9, 4, 0, "shared", "shared", ">o9", __nsThunk49, nil) - registerMember(registrar, 9, 2, 0, "describe", "describe(_:)", "o9?>s", __nsThunk50, nil) - registerMember(registrar, 10, 0, 0, "constructor", "init(id:)", "i64>o10", __nsThunk51, nil) - registerMember(registrar, 10, 3, 0, "id", "id", ">i64", __nsThunk52, nil) - registerMember(registrar, 10, 1, 0, "same", "same()", ">o10", __nsThunk53, nil) - registerMember(registrar, 10, 4, 0, "liveCount", "liveCount", ">i64", __nsThunk54, nil) - registerMember(registrar, -1, 5, 0, "echoInt8", "echoInt8(_:)", "i8>i8", __nsThunk55, nil) - registerMember(registrar, 1, 3, 0, "hashValue", "hashValue", ">i64", __nsThunk56, nil) - registerMember(registrar, 5, 3, 0, "hashValue", "hashValue", ">i64", __nsThunk57, nil) + registerMember(registrar, 1, 7, 0, "invalidSide", "invalidSide(_:)", "f64>t1", nil, nil) + registerMember(registrar, 1, 7, 0, "tooManySides", "tooManySides(count:limit:)", "i64,i64>t1", nil, nil) + registerMember(registrar, 1, 7, 0, "unknown", "unknown", ">t1", nil, nil) + registerMember(registrar, -1, 5, 0, "allFlavors", "allFlavors()", ">[e9]", __nsThunk4, nil) + registerMember(registrar, -1, 5, 0, "echoUInt64", "echoUInt64(_:)", "u64>u64", __nsThunk5, nil) + registerMember(registrar, -1, 5, 0, "greetLater", "greetLater(_:completion:)", "s?,(s?)>v", __nsThunk6, nil) + registerMember(registrar, -1, 5, 0, "largestInt", "largestInt()", ">i64", __nsThunk7, nil) + registerMember(registrar, -1, 5, 8, "namesLater", "namesLater(_:)", "i64>[s]", __nsThunk8, nil) + registerMember(registrar, -1, 5, 0, "wordCounts", "wordCounts(_:)", "[s]>{i64}", __nsThunk9, nil) + registerMember(registrar, 3, 0, 0, "constructor", "init(symbol:)", "s>o3", __nsThunk10, nil) + registerMember(registrar, 3, 3, 2, "symbol", "symbol", ">s", __nsThunk11, __nsThunk12) + registerMember(registrar, 2, 7, 0, "area", "area(width:height:)", "f64,f64>t2", nil, nil) + registerMember(registrar, 2, 7, 0, "none", "none", ">t2", nil, nil) + registerMember(registrar, 2, 3, 0, "isNone", "isNone", ">b", __nsThunk13, nil) + registerMember(registrar, 2, 7, 0, "length", "length(_:)", "f64>t2", nil, nil) + registerMember(registrar, -1, 5, 1, "checkedSide", "checkedSide(_:)", "f64>f64", __nsThunk14, nil) + registerMember(registrar, -1, 5, 9, "delayedEcho", "delayedEcho(_:after:)", "s,f64>s", __nsThunk15, nil) + registerMember(registrar, -1, 5, 0, "firstSubview", "firstSubview(of:)", "@UIView>@UIView?", __nsThunk16, nil) + registerMember(registrar, -1, 5, 8, "measureLater", "measureLater(_:)", "f64>t2", __nsThunk17, nil) + registerMember(registrar, -1, 5, 0, "measurements", "measurements()", ">[t2]", __nsThunk18, nil) + registerMember(registrar, -1, 5, 0, "swapTrackers", "swapTrackers(_:_:)", "&o19,&o19>v", __nsThunk19, nil) + registerMember(registrar, 4, 7, 0, "none", "none", ">e4", nil, nil) + registerMember(registrar, 4, 7, 0, "rain", "rain", ">e4", nil, nil) + registerMember(registrar, 4, 7, 0, "snow", "snow", ">e4", nil, nil) + registerMember(registrar, 4, 0, 0, "constructor", "init(rawValue:)", "s>e4?", __nsThunk20, nil) + registerMember(registrar, -1, 6, 0, "defaultFlavor", "defaultFlavor", ">e9", __nsThunk21, nil) + registerMember(registrar, -1, 6, 2, "globalCounter", "globalCounter", ">i64", __nsThunk22, __nsThunk23) + registerMember(registrar, -1, 5, 0, "makeDefaultPoint", "makeDefaultPoint()", ">o7", __nsThunk24, nil) + registerMember(registrar, -1, 5, 8, "makeTrackerLater", "makeTrackerLater(id:)", "i64>o19", __nsThunk25, nil) + registerMember(registrar, 5, 0, 0, "constructor", "init(id:)", "i64>o5", __nsThunk26, nil) + registerMember(registrar, 5, 3, 2, "id", "id", ">i64", __nsThunk27, __nsThunk28) + registerMember(registrar, 6, 0, 0, "constructor", "init(inner:outer:)", "o7,o7>o6", __nsThunk29, nil) + registerMember(registrar, 6, 3, 2, "inner", "inner", ">o7", __nsThunk30, __nsThunk31) + registerMember(registrar, 6, 3, 2, "outer", "outer", ">o7", __nsThunk32, __nsThunk33) + registerMember(registrar, 6, 1, 0, "expand", "expand(by:)", "f64>v", __nsThunk34, nil) + registerMember(registrar, -1, 5, 0, "area", "area(of:)", "t2>f64", __nsThunk35, nil) + registerMember(registrar, -1, 5, 0, "bump", "bump(_:)", "&i64>v", __nsThunk36, nil) + registerMember(registrar, -1, 5, 0, "echo", "echo(_:)", "t15>t15", __nsThunk37, nil) + registerMember(registrar, -1, 5, 0, "host", "host(of:)", "U>s?", __nsThunk38, nil) + registerMember(registrar, -1, 5, 0, "ramp", "ramp(_:)", "i64>B", __nsThunk39, nil) + registerMember(registrar, -1, 5, 0, "tags", "tags(_:)", "[@UIView]>[i64]", __nsThunk40, nil) + registerMember(registrar, -1, 5, 0, "text", "text(of:)", "@SwiftDemo.Note>s", __nsThunk41, nil) + registerMember(registrar, 7, 3, 0, "description", "description", ">s", __nsThunk42, nil) + registerMember(registrar, 7, 0, 0, "constructor", "init(x:y:)", "f64,f64>o7", __nsThunk43, nil) + registerMember(registrar, 7, 3, 2, "x", "x", ">f64", __nsThunk44, __nsThunk45) + registerMember(registrar, 7, 3, 2, "y", "y", ">f64", __nsThunk46, __nsThunk47) + registerMember(registrar, 7, 3, 0, "length", "length", ">f64", __nsThunk48, nil) + registerMember(registrar, -1, 5, 0, "clear", "clear(_:)", "&s?>v", __nsThunk49, nil) + registerMember(registrar, -1, 5, 1, "halve", "halve(_:)", "&i64>v", __nsThunk50, nil) + registerMember(registrar, -1, 5, 0, "names", "names(_:)", "i64>[s]", __nsThunk51, nil) + registerMember(registrar, -1, 5, 0, "shout", "shout(_:)", "s?>s?", __nsThunk52, nil) + registerMember(registrar, -1, 5, 0, "total", "total(_:)", "[f64]>f64", __nsThunk53, nil) + registerMember(registrar, 8, 0, 16, "constructor", "init()", ">o8", __nsThunk54, nil) + registerMember(registrar, 9, 3, 0, "description", "description", ">s", __nsThunk55, nil) + registerMember(registrar, 9, 7, 0, "vanilla", "vanilla", ">e9", nil, nil) + registerMember(registrar, 9, 0, 0, "constructor", "init(rawValue:)", "i64>e9?", __nsThunk56, nil) + registerMember(registrar, 9, 7, 0, "chocolate", "chocolate", ">e9", nil, nil) + registerMember(registrar, 10, 1, 0, "modernOnly", "modernOnly()", ">v", __nsThunk57, nil) + registerMember(registrar, 10, 1, 0, "legacyFetch", "legacyFetch()", ">v", __nsThunk58, nil) + registerMember(registrar, 10, 1, 0, "each", "each(_:)", "(i64)>v", __nsThunk59, nil) + registerMember(registrar, 10, 1, 1, "load", "load(path:)", "s>B", __nsThunk60, nil) + registerMember(registrar, 10, 1, 8, "wait", "wait(seconds:)", "f64>v", __nsThunk61, nil) + registerMember(registrar, 10, 1, 9, "fetch", "fetch(url:)", "U>s", __nsThunk62, nil) + registerMember(registrar, 10, 1, 0, "lookup", "lookup(table:key:)", "{i64},s>i64?", __nsThunk63, nil) + registerMember(registrar, 10, 1, 0, "update", "update(_:)", "&o7>v", __nsThunk64, nil) + registerMember(registrar, 10, 1, 0, "oldFetch", "oldFetch()", ">v", __nsThunk65, nil) + registerMember(registrar, 10, 0, 0, "constructor", "init()", ">o10", __nsThunk66, nil) + registerMember(registrar, 11, 3, 0, "area", "area", ">f64", __nsThunk67, nil) + registerMember(registrar, 11, 0, 0, "constructor", "init(side:)", "f64>o11", __nsThunk68, nil) + registerMember(registrar, 11, 3, 2, "side", "side", ">f64", __nsThunk69, __nsThunk70) + registerMember(registrar, 11, 1, 0, "greet", "greet(name:)", "s>s", __nsThunk71, nil) + registerMember(registrar, 11, 1, 0, "scale", "scale(by:)", "f64>v", __nsThunk72, nil) + registerMember(registrar, 11, 4, 0, "sides", "sides", ">i64", __nsThunk73, nil) + registerMember(registrar, -1, 5, 0, "append", "append(_:to:)", "s,&[s]>v", __nsThunk74, nil) + registerMember(registrar, 12, 3, 8, "step", "step", ">i64", __nsThunk75, nil) + registerMember(registrar, 12, 1, 0, "label", "label()", ">s", __nsThunk76, nil) + registerMember(registrar, 12, 3, 8, "value", "value", ">i64", __nsThunk77, nil) + registerMember(registrar, 12, 1, 8, "increment", "increment()", ">i64", __nsThunk78, nil) + registerMember(registrar, 12, 0, 0, "constructor", "init()", ">o12", __nsThunk79, nil) + registerMember(registrar, 13, 7, 0, "sum", "sum(_:_:)", "t13,t13>t13", nil, nil) + registerMember(registrar, 13, 3, 0, "value", "value", ">f64", __nsThunk80, nil) + registerMember(registrar, 13, 7, 0, "negate", "negate(_:)", "t13>t13", nil, nil) + registerMember(registrar, 13, 7, 0, "number", "number(_:)", "f64>t13", nil, nil) + registerMember(registrar, 14, 1, 8, "strokeLater", "strokeLater()", ">i64", __nsThunk81, nil) + registerMember(registrar, 14, 1, 16, "stroke", "stroke()", ">i64", __nsThunk82, nil) + registerMember(registrar, 14, 3, 16, "strokes", "strokes", ">i64", __nsThunk83, nil) + registerMember(registrar, 14, 0, 16, "constructor", "init()", ">o14", __nsThunk84, nil) + registerMember(registrar, 15, 7, 0, "maybe", "maybe(_:)", "i64?>t15", nil, nil) + registerMember(registrar, 15, 7, 0, "names", "names(_:)", "[s]>t15", nil, nil) + registerMember(registrar, 15, 7, 0, "point", "point(_:)", "o7>t15", nil, nil) + registerMember(registrar, 15, 7, 0, "flavor", "flavor(_:)", "e9>t15", nil, nil) + registerMember(registrar, 15, 7, 0, "tracker", "tracker(_:)", "o19>t15", nil, nil) + registerMember(registrar, 16, 3, 0, "vertexCount", "vertexCount", ">i64", __nsThunk85, nil) + registerMember(registrar, 16, 2, 0, "make", "make()", ">o16", __nsThunk86, nil) + registerMember(registrar, 16, 0, 0, "constructor", "init(name:vertexCount:)", "s,i64>o16", __nsThunk87, nil) + registerMember(registrar, 16, 0, 0, "constructor", "init(name:)", "s>o16?", __nsThunk88, nil) + registerMember(registrar, 16, 3, 0, "name", "name", ">s", __nsThunk89, nil) + registerMember(registrar, 17, 7, 0, "solid", "solid", ">e17", nil, nil) + registerMember(registrar, 17, 7, 0, "dashed", "dashed", ">e17", nil, nil) + registerMember(registrar, 17, 0, 0, "constructor", "init(rawValue:)", "s>e17?", __nsThunk90, nil) + registerMember(registrar, 16, 1, 0, "scale", "scale(x:y:)", "f64,f64>v", __nsThunk91, nil) + registerMember(registrar, 16, 1, 4, "scale", "scale(by:)", "f64>v", __nsThunk92, nil) + registerMember(registrar, 16, 1, 4, "scale", "scale(by:)", "i64>v", __nsThunk93, nil) + registerMember(registrar, 16, 3, 0, "style", "style", ">e17", __nsThunk94, nil) + registerMember(registrar, 16, 4, 0, "shared", "shared", ">o16", __nsThunk95, nil) + registerMember(registrar, 18, 0, 0, "constructor", "init(perimeter:)", "f64>o18", __nsThunk96, nil) + registerMember(registrar, 18, 3, 2, "perimeter", "perimeter", ">f64", __nsThunk97, __nsThunk98) + registerMember(registrar, 16, 1, 0, "metrics", "metrics(side:)", "f64>o18", __nsThunk99, nil) + registerMember(registrar, 16, 2, 0, "describe", "describe(_:)", "o16?>s", __nsThunk100, nil) + registerMember(registrar, 19, 0, 0, "constructor", "init(id:)", "i64>o19", __nsThunk101, nil) + registerMember(registrar, 19, 3, 0, "id", "id", ">i64", __nsThunk102, nil) + registerMember(registrar, 19, 1, 0, "same", "same()", ">o19", __nsThunk103, nil) + registerMember(registrar, 19, 4, 0, "liveCount", "liveCount", ">i64", __nsThunk104, nil) + registerMember(registrar, -1, 5, 0, "explain", "explain(_:)", "t1>s", __nsThunk105, nil) + registerMember(registrar, -1, 5, 0, "lengths", "lengths(_:)", "{s}>{i64}", __nsThunk106, nil) + registerMember(registrar, -1, 5, 0, "measure", "measure(_:by:)", "f64,f64?>t2", __nsThunk107, nil) + registerMember(registrar, -1, 5, 0, "nextDay", "nextDay(after:)", "D>D", __nsThunk108, nil) + registerMember(registrar, -1, 5, 0, "resolve", "resolve(_:against:)", "s,U>U", __nsThunk109, nil) + registerMember(registrar, 20, 1, 0, "publishLater", "publishLater(_:)", "s>v", __nsThunk110, nil) + registerMember(registrar, 20, 1, 0, "clear", "clear()", ">v", __nsThunk111, nil) + registerMember(registrar, 20, 3, 0, "count", "count", ">i64", __nsThunk112, nil) + registerMember(registrar, 20, 1, 0, "publish", "publish(_:)", "s>v", __nsThunk113, nil) + registerMember(registrar, 20, 1, 0, "subscribe", "subscribe(_:)", "(s)>v", __nsThunk114, nil) + registerMember(registrar, 20, 0, 0, "constructor", "init()", ">o20", __nsThunk115, nil) + registerMember(registrar, -1, 5, 0, "centroid", "centroid(of:)", "[o7]>o7", __nsThunk116, nil) + registerMember(registrar, -1, 5, 0, "checksum", "checksum(_:)", "B>i64", __nsThunk117, nil) + registerMember(registrar, -1, 5, 0, "describe", "describe(_:)", "@UIView>s", __nsThunk118, nil) + registerMember(registrar, -1, 5, 0, "echoInt8", "echoInt8(_:)", "i8>i8", __nsThunk119, nil) + registerMember(registrar, -1, 5, 0, "makeNote", "makeNote(_:)", "s>@SwiftDemo.Note", __nsThunk120, nil) + registerMember(registrar, -1, 5, 0, "mirrored", "mirrored(_:)", "[[i64]]>[[i64]]", __nsThunk121, nil) + registerMember(registrar, -1, 5, 0, "simplify", "simplify(_:)", "t13>t13", __nsThunk122, nil) + registerMember(registrar, -1, 5, 0, "trackers", "trackers(_:)", "[i64]>[o19]", __nsThunk123, nil) + registerMember(registrar, -1, 5, 0, "countdown", "countdown(from:_:)", "i64,(i64,b)>v", __nsThunk124, nil) + registerMember(registrar, -1, 5, 16, "makeLabel", "makeLabel(_:)", "s>@UILabel", __nsThunk125, nil) + registerMember(registrar, -1, 5, 8, "noteLater", "noteLater(_:)", "s>@SwiftDemo.Note", __nsThunk126, nil) + registerMember(registrar, -1, 5, 0, "onMeasure", "onMeasure(_:)", "(t2)>v", __nsThunk127, nil) + registerMember(registrar, 4, 3, 0, "hashValue", "hashValue", ">i64", __nsThunk128, nil) + registerMember(registrar, 9, 3, 0, "hashValue", "hashValue", ">i64", __nsThunk129, nil) + registerMember(registrar, 17, 3, 0, "hashValue", "hashValue", ">i64", __nsThunk130, nil) + registerMember(registrar, 1, 3, 0, "localizedDescription", "localizedDescription", ">s", __nsThunk131, nil) } diff --git a/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Extensions.swift b/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Extensions.swift index 6bbc747b..26a389ec 100644 --- a/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Extensions.swift +++ b/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Extensions.swift @@ -27,3 +27,15 @@ extension Array where Element == Point { return Point(x: sx / Double(count), y: sy / Double(count)) } } + +extension Polygon { + public enum Style: String { case solid, dashed } + + public struct Metrics { + public var perimeter: Double + public init(perimeter: Double) { self.perimeter = perimeter } + } + + public var style: Style { vertexCount > 3 ? .dashed : .solid } + public func metrics(side: Double) -> Metrics { Metrics(perimeter: side * Double(vertexCount)) } +} diff --git a/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Shapes.swift b/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Shapes.swift index 0a6f1ec8..6169eb70 100644 --- a/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Shapes.swift +++ b/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Shapes.swift @@ -95,9 +95,10 @@ public struct Ring { public actor Counter { public private(set) var value: Int = 0 + public var step: Int = 1 public init() {} public func increment() -> Int { - value += 1 + value += step return value } public nonisolated func label() -> String { "counter" } diff --git a/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Values.swift b/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Values.swift index 4036b478..404bb5ce 100644 --- a/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Values.swift +++ b/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Values.swift @@ -1,6 +1,8 @@ // Declarations the runtime tests use to exercise value marshaling, errors and // object lifetime. +import Foundation + public func checkedSide(_ side: Double) throws -> Double { if side < 0 { throw ShapeError.invalidSide(side) } return side @@ -24,3 +26,148 @@ public final class Tracker { public func same() -> Tracker { self } } + +public func delayedEcho(_ text: String, after seconds: Double) async throws -> String { + if seconds < 0 { throw ShapeError.invalidSide(seconds) } + try await Task.sleep(nanoseconds: UInt64(seconds * 1_000_000_000)) + return text +} + +public func makeTrackerLater(id: Int) async -> Tracker { + await Task.yield() + return Tracker(id: id) +} + +@MainActor +public final class Palette { + public private(set) var strokes = 0 + public init() {} + public func stroke() -> Int { + strokes += 1 + return strokes + } + public func strokeLater() async -> Int { + await Task.yield() + return stroke() + } +} + +public func names(_ count: Int) -> [String] { (0.. Double { values.reduce(0, +) } +public func centroid(of points: [Point]) -> Point { points.centroid() } +public func mirrored(_ grid: [[Int]]) -> [[Int]] { grid.map { Array($0.reversed()) } } +public func wordCounts(_ words: [String]) -> [String: Int] { + words.reduce(into: [:]) { $0[$1, default: 0] += 1 } +} +public func lengths(_ table: [String: String]) -> [String: Int] { table.mapValues { $0.count } } +public func trackers(_ ids: [Int]) -> [Tracker] { ids.map { Tracker(id: $0) } } +public func allFlavors() -> [Flavor] { [.vanilla, .chocolate] } +public func nextDay(after date: Date) -> Date { date.addingTimeInterval(86_400) } +public func host(of url: URL) -> String? { url.host } +public func resolve(_ path: String, against base: URL) -> URL { base.appendingPathComponent(path) } +public func checksum(_ data: Data) -> Int { data.reduce(0) { $0 + Int($1) } } +public func ramp(_ count: Int) -> Data { Data((0.. [String] { + await Task.yield() + return names(count) +} + +public func countdown(from start: Int, _ tick: (Int, Bool) -> Void) { + for value in stride(from: start, through: 0, by: -1) { + tick(value, value == 0) + } +} + +public func greetLater(_ name: String?, completion: @escaping @Sendable (String?) -> Void) { + DispatchQueue.global().async { + completion(name.map { "hi \($0)" }) + } +} + +public final class Notifier: @unchecked Sendable { + private var handlers: [@Sendable (String) -> Void] = [] + public init() {} + public var count: Int { handlers.count } + public func subscribe(_ handler: @escaping @Sendable (String) -> Void) { handlers.append(handler) } + public func publish(_ message: String) { handlers.forEach { $0(message) } } + public func publishLater(_ message: String) { + let handlers = self.handlers + DispatchQueue.global().async { handlers.forEach { $0(message) } } + } + public func clear() { handlers.removeAll() } +} + +public func area(of measurement: Measurement) -> Double { + switch measurement { + case let .area(width, height): return width * height + case .length, .none: return 0 + } +} + +public func measure(_ width: Double, by height: Double?) -> Measurement { + guard let height else { return width == 0 ? .none : .length(width) } + return .area(width: width, height: height) +} + +public func measurements() -> [Measurement] { [.length(1), .area(width: 2, height: 3), .none] } + +public func measureLater(_ width: Double) async -> Measurement { + await Task.yield() + return .length(width) +} + +public func onMeasure(_ body: (Measurement) -> Void) { body(.area(width: 1, height: 2)) } + +public func explain(_ error: ShapeError) -> String { + switch error { + case let .invalidSide(side): return "invalid side \(side)" + case let .tooManySides(count, limit): return "\(count) > \(limit)" + case .unknown: return "unknown" + } +} + +public indirect enum Formula { + case number(Double) + case sum(Formula, Formula) + case negate(Formula) + + public var value: Double { + switch self { + case let .number(value): return value + case let .sum(a, b): return a.value + b.value + case let .negate(formula): return -formula.value + } + } +} + +public func simplify(_ formula: Formula) -> Formula { .number(formula.value) } + +public enum Payload { + case tracker(Tracker) + case point(Point) + case flavor(Flavor) + case maybe(Int?) + case names([String]) +} + +public func echo(_ payload: Payload) -> Payload { payload } + +// Not bridged: a closure cannot be copied into a JS value. +public enum Job { + case run(() -> Void) + case idle + + public struct Ticket { + public var id: Int + public init(id: Int) { self.id = id } + } +} + +public func bump(_ value: inout Int) { value += 1 } +public func append(_ word: String, to words: inout [String]) { words.append(word) } +public func halve(_ value: inout Int) throws { + guard value.isMultiple(of: 2) else { throw ShapeError.invalidSide(Double(value)) } + value /= 2 +} +public func clear(_ name: inout String?) { name = nil } +public func swapTrackers(_ a: inout Tracker, _ b: inout Tracker) { swap(&a, &b) } diff --git a/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Views.swift b/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Views.swift new file mode 100644 index 00000000..e39a3fbb --- /dev/null +++ b/metadata-generator/TestFixtures/SwiftDemo/Sources/SwiftDemo/Views.swift @@ -0,0 +1,29 @@ +// Objective-C classes in Swift signatures, which cross as NativeScript's +// ordinary Objective-C wrappers. + +import UIKit + +public func describe(_ view: UIView) -> String { "\(type(of: view)) \(view.tag)" } + +@MainActor public func makeLabel(_ text: String) -> UILabel { + let label = UILabel() + label.text = text + return label +} + +public func tags(_ views: [UIView]) -> [Int] { views.map(\.tag) } + +public func firstSubview(of view: UIView) -> UIView? { view.subviews.first } + +public final class Note: NSObject { + public let text: String + public init(text: String) { self.text = text } +} + +public func makeNote(_ text: String) -> Note { Note(text: text) } +public func text(of note: Note) -> String { note.text } + +public func noteLater(_ text: String) async -> Note { + await Task.yield() + return Note(text: text) +} diff --git a/metadata-generator/TestFixtures/SwiftDemo/symbolgraphs/SwiftDemo.symbols.json b/metadata-generator/TestFixtures/SwiftDemo/symbolgraphs/SwiftDemo.symbols.json index 141d999d..d9cfe0a5 100644 --- a/metadata-generator/TestFixtures/SwiftDemo/symbolgraphs/SwiftDemo.symbols.json +++ b/metadata-generator/TestFixtures/SwiftDemo/symbolgraphs/SwiftDemo.symbols.json @@ -1 +1 @@ -{"metadata":{"formatVersion":{"major":0,"minor":6,"patch":0},"generator":"Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)"},"module":{"name":"SwiftDemo","platform":{"architecture":"arm64","environment":"simulator","vendor":"apple","operatingSystem":{"name":"ios","minimumVersion":{"major":15,"minor":0}}}},"symbols":[{"kind":{"identifier":"swift.protocol","displayName":"Protocol"},"identifier":{"precise":"s:9SwiftDemo7GreeterP","interfaceLanguage":"swift"},"pathComponents":["Greeter"],"names":{"title":"Greeter","navigator":[{"kind":"identifier","spelling":"Greeter"}],"subHeading":[{"kind":"keyword","spelling":"protocol"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Greeter"}]},"declarationFragments":[{"kind":"keyword","spelling":"protocol"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Greeter"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":0,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7GreeterP5greet4nameS2S_tF","interfaceLanguage":"swift"},"pathComponents":["Greeter","greet(name:)"],"names":{"title":"greet(name:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":1,"character":9}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo0B0C","interfaceLanguage":"swift"},"pathComponents":["Demo"],"names":{"title":"Demo","navigator":[{"kind":"identifier","spelling":"Demo"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Demo"}]},"declarationFragments":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Demo"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":4,"character":13}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo0B0CACycfc","interfaceLanguage":"swift"},"pathComponents":["Demo","init()"],"names":{"title":"init()","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}]},"functionSignature":{},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":5,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo0B0C5greet4nameS2S_tF","interfaceLanguage":"swift"},"pathComponents":["Demo","greet(name:)"],"names":{"title":"greet(name:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":6,"character":16}}},{"kind":{"identifier":"swift.struct","displayName":"Structure"},"identifier":{"precise":"s:9SwiftDemo5PointV","interfaceLanguage":"swift"},"pathComponents":["Point"],"names":{"title":"Point","navigator":[{"kind":"identifier","spelling":"Point"}],"subHeading":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Point"}]},"declarationFragments":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Point"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":9,"character":14}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo5PointV1xSdvp","interfaceLanguage":"swift"},"pathComponents":["Point","x"],"names":{"title":"x","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":10,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo5PointV1ySdvp","interfaceLanguage":"swift"},"pathComponents":["Point","y"],"names":{"title":"y","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":11,"character":15}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo5PointV1x1yACSd_Sdtcfc","interfaceLanguage":"swift"},"pathComponents":["Point","init(x:y:)"],"names":{"title":"init(x:y:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"x","declarationFragments":[{"kind":"identifier","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},{"name":"y","declarationFragments":[{"kind":"identifier","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":12,"character":11}}},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo6FlavorO","interfaceLanguage":"swift"},"pathComponents":["Flavor"],"names":{"title":"Flavor","navigator":[{"kind":"identifier","spelling":"Flavor"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Flavor"}]},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Flavor"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":15,"character":12}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo6FlavorO","interfaceLanguage":"swift"},"pathComponents":["Flavor","hashValue"],"names":{"title":"hashValue","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hashValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hashValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public"},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo6FlavorO","interfaceLanguage":"swift"},"pathComponents":["Flavor","hash(into:)"],"names":{"title":"hash(into:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hash"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"into"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"into","internalName":"hasher","declarationFragments":[{"kind":"identifier","spelling":"hasher"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"}]}],"returns":[{"kind":"text","spelling":"()"}]},"swiftGenerics":{"constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hash"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"into"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"hasher"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"},{"kind":"text","spelling":")"}],"accessLevel":"public"},{"kind":{"identifier":"swift.func.op","displayName":"Operator"},"identifier":{"precise":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO","interfaceLanguage":"swift"},"pathComponents":["Flavor","!=(_:_:)"],"names":{"title":"!=(_:_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"!="},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":", "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"docComment":{"module":"Swift","lines":[{"text":"Returns a Boolean value indicating whether two values are not equal."},{"text":""},{"text":"Inequality is the inverse of equality. For any values `a` and `b`, `a != b`"},{"text":"implies that `a == b` is `false`."},{"text":""},{"text":"This is the default implementation of the not-equal-to operator (`!=`)"},{"text":"for any type that conforms to `Equatable`."},{"text":""},{"text":"- Parameters:"},{"text":" - lhs: A value to compare."},{"text":" - rhs: Another value to compare."}]},"functionSignature":{"parameters":[{"name":"lhs","declarationFragments":[{"kind":"identifier","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Self"}]},{"name":"rhs","declarationFragments":[{"kind":"identifier","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Self"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"!="},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"internalParam","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":", "},{"kind":"internalParam","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}],"accessLevel":"public"},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo6FlavorO7vanillayA2CmF","interfaceLanguage":"swift"},"pathComponents":["Flavor","vanilla"],"names":{"title":"Flavor.vanilla","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"vanilla"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"vanilla"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":15,"character":31}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo6FlavorO9chocolateyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Flavor","chocolate"],"names":{"title":"Flavor.chocolate","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"chocolate"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"chocolate"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":15,"character":44}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo6FlavorO8rawValueACSgSi_tcfc","interfaceLanguage":"swift"},"pathComponents":["Flavor","init(rawValue:)"],"names":{"title":"init(rawValue:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"rawValue","declarationFragments":[{"kind":"identifier","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"public"},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo0B0C5greet4name5timesS2S_SitF","interfaceLanguage":"swift"},"pathComponents":["Demo","greet(name:times:)"],"names":{"title":"greet(name:times:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"times"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"times","declarationFragments":[{"kind":"identifier","spelling":"times"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.class"},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"times"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":1,"character":16}}},{"kind":{"identifier":"swift.type.property","displayName":"Type Property"},"identifier":{"precise":"s:9SwiftDemo0B0C7versionSSvpZ","interfaceLanguage":"swift"},"pathComponents":["Demo","version"],"names":{"title":"version","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"version"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.class"},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"version"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":5,"character":22}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo5PointV11descriptionSSvp","interfaceLanguage":"swift"},"pathComponents":["Point","description"],"names":{"title":"description","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"description"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.struct"},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"description"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":9,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo5PointV6lengthSdvp","interfaceLanguage":"swift"},"pathComponents":["Point","length"],"names":{"title":"length","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"length"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.struct"},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"length"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":10,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo6FlavorO11descriptionSSvp","interfaceLanguage":"swift"},"pathComponents":["Flavor","description"],"names":{"title":"description","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"description"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.enum"},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"description"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":14,"character":15}}},{"kind":{"identifier":"swift.protocol","displayName":"Protocol"},"identifier":{"precise":"s:9SwiftDemo5ShapeP","interfaceLanguage":"swift"},"pathComponents":["Shape"],"names":{"title":"Shape","navigator":[{"kind":"identifier","spelling":"Shape"}],"subHeading":[{"kind":"keyword","spelling":"protocol"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Shape"}]},"declarationFragments":[{"kind":"keyword","spelling":"protocol"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Shape"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Greeter","preciseIdentifier":"s:9SwiftDemo7GreeterP"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":2,"character":16}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo5ShapeP4areaSdvp","interfaceLanguage":"swift"},"pathComponents":["Shape","area"],"names":{"title":"area","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":3,"character":8}}},{"kind":{"identifier":"swift.type.property","displayName":"Type Property"},"identifier":{"precise":"s:9SwiftDemo5ShapeP5sidesSivpZ","interfaceLanguage":"swift"},"pathComponents":["Shape","sides"],"names":{"title":"sides","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"sides"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"sides"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":4,"character":15}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo7PolygonC","interfaceLanguage":"swift"},"pathComponents":["Polygon"],"names":{"title":"Polygon","navigator":[{"kind":"identifier","spelling":"Polygon"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Polygon"}]},"declarationFragments":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Polygon"}],"accessLevel":"open","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":7,"character":11}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7PolygonC4nameSSvp","interfaceLanguage":"swift"},"pathComponents":["Polygon","name"],"names":{"title":"name","subHeading":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":8,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7PolygonC11vertexCountSivp","interfaceLanguage":"swift"},"pathComponents":["Polygon","vertexCount"],"names":{"title":"vertexCount","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"vertexCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"vertexCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { get }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":9,"character":28}}},{"kind":{"identifier":"swift.type.property","displayName":"Type Property"},"identifier":{"precise":"s:9SwiftDemo7PolygonC6sharedACvpZ","interfaceLanguage":"swift"},"pathComponents":["Polygon","shared"],"names":{"title":"shared","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"shared"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"shared"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":10,"character":22}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7PolygonC4name11vertexCountACSS_Sitcfc","interfaceLanguage":"swift"},"pathComponents":["Polygon","init(name:vertexCount:)"],"names":{"title":"init(name:vertexCount:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"vertexCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"vertexCount","declarationFragments":[{"kind":"identifier","spelling":"vertexCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"vertexCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":12,"character":11}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7PolygonC4nameACSgSS_tcfc","interfaceLanguage":"swift"},"pathComponents":["Polygon","init(name:)"],"names":{"title":"init(name:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"convenience"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":17,"character":23}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5scale2byySd_tF","interfaceLanguage":"swift"},"pathComponents":["Polygon","scale(by:)"],"names":{"title":"scale(by:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"by","internalName":"factor","declarationFragments":[{"kind":"identifier","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"open","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":22,"character":14}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5scale2byySi_tF","interfaceLanguage":"swift"},"pathComponents":["Polygon","scale(by:)"],"names":{"title":"scale(by:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"by","internalName":"factor","declarationFragments":[{"kind":"identifier","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"open","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":23,"character":14}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5scale1x1yySd_SdtF","interfaceLanguage":"swift"},"pathComponents":["Polygon","scale(x:y:)"],"names":{"title":"scale(x:y:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"x","declarationFragments":[{"kind":"identifier","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},{"name":"y","declarationFragments":[{"kind":"identifier","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":24,"character":16}}},{"kind":{"identifier":"swift.type.method","displayName":"Type Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC4makeACyFZ","interfaceLanguage":"swift"},"pathComponents":["Polygon","make()"],"names":{"title":"make()","subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"make"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"}]},"declarationFragments":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"make"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":26,"character":22}}},{"kind":{"identifier":"swift.type.method","displayName":"Type Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC8describeySSACSgFZ","interfaceLanguage":"swift"},"pathComponents":["Polygon","describe(_:)"],"names":{"title":"describe(_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"describe"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"polygon","declarationFragments":[{"kind":"identifier","spelling":"polygon"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"},{"kind":"text","spelling":"?"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"describe"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"polygon"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":27,"character":23}}},{"kind":{"identifier":"swift.subscript","displayName":"Instance Subscript"},"identifier":{"precise":"s:9SwiftDemo7PolygonCyAA5PointVSicip","interfaceLanguage":"swift"},"pathComponents":["Polygon","subscript(_:)"],"names":{"title":"subscript(_:)","subHeading":[{"kind":"keyword","spelling":"subscript"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"functionSignature":{"parameters":[{"name":"index","declarationFragments":[{"kind":"identifier","spelling":"index"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"declarationFragments":[{"kind":"keyword","spelling":"subscript"},{"kind":"text","spelling":"("},{"kind":"internalParam","spelling":"index"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":29,"character":11}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo6SquareC","interfaceLanguage":"swift"},"pathComponents":["Square"],"names":{"title":"Square","navigator":[{"kind":"identifier","spelling":"Square"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Square"}]},"declarationFragments":[{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Square"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":34,"character":19}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo6SquareC4sideSdvp","interfaceLanguage":"swift"},"pathComponents":["Square","side"],"names":{"title":"side","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":35,"character":15}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo6SquareC4sideACSd_tcfc","interfaceLanguage":"swift"},"pathComponents":["Square","init(side:)"],"names":{"title":"init(side:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"side","declarationFragments":[{"kind":"identifier","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":37,"character":11}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo6SquareC4areaSdvp","interfaceLanguage":"swift"},"pathComponents":["Square","area"],"names":{"title":"area","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":42,"character":15}}},{"kind":{"identifier":"swift.type.property","displayName":"Type Property"},"identifier":{"precise":"s:9SwiftDemo6SquareC5sidesSivpZ","interfaceLanguage":"swift"},"pathComponents":["Square","sides"],"names":{"title":"sides","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"sides"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"sides"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":43,"character":22}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6SquareC5greet4nameS2S_tF","interfaceLanguage":"swift"},"pathComponents":["Square","greet(name:)"],"names":{"title":"greet(name:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":44,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6SquareC5scale2byySd_tF","interfaceLanguage":"swift"},"pathComponents":["Square","scale(by:)"],"names":{"title":"scale(by:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"by","internalName":"factor","declarationFragments":[{"kind":"identifier","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"override"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":46,"character":25}}},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo13PrecipitationO","interfaceLanguage":"swift"},"pathComponents":["Precipitation"],"names":{"title":"Precipitation","navigator":[{"kind":"identifier","spelling":"Precipitation"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Precipitation"}]},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Precipitation"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":50,"character":12}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","interfaceLanguage":"swift"},"pathComponents":["Precipitation","hashValue"],"names":{"title":"hashValue","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hashValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hashValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public"},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","interfaceLanguage":"swift"},"pathComponents":["Precipitation","hash(into:)"],"names":{"title":"hash(into:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hash"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"into"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"into","internalName":"hasher","declarationFragments":[{"kind":"identifier","spelling":"hasher"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"}]}],"returns":[{"kind":"text","spelling":"()"}]},"swiftGenerics":{"constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hash"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"into"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"hasher"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"},{"kind":"text","spelling":")"}],"accessLevel":"public"},{"kind":{"identifier":"swift.func.op","displayName":"Operator"},"identifier":{"precise":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","interfaceLanguage":"swift"},"pathComponents":["Precipitation","!=(_:_:)"],"names":{"title":"!=(_:_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"!="},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":", "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"docComment":{"module":"Swift","lines":[{"text":"Returns a Boolean value indicating whether two values are not equal."},{"text":""},{"text":"Inequality is the inverse of equality. For any values `a` and `b`, `a != b`"},{"text":"implies that `a == b` is `false`."},{"text":""},{"text":"This is the default implementation of the not-equal-to operator (`!=`)"},{"text":"for any type that conforms to `Equatable`."},{"text":""},{"text":"- Parameters:"},{"text":" - lhs: A value to compare."},{"text":" - rhs: Another value to compare."}]},"functionSignature":{"parameters":[{"name":"lhs","declarationFragments":[{"kind":"identifier","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Self"}]},{"name":"rhs","declarationFragments":[{"kind":"identifier","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Self"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"!="},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"internalParam","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":", "},{"kind":"internalParam","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}],"accessLevel":"public"},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo13PrecipitationO4rainyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Precipitation","rain"],"names":{"title":"Precipitation.rain","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"rain"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"rain"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":51,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo13PrecipitationO4snowyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Precipitation","snow"],"names":{"title":"Precipitation.snow","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"snow"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"snow"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":51,"character":15}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo13PrecipitationO4noneyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Precipitation","none"],"names":{"title":"Precipitation.none","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"none"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"none"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":51,"character":21}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo13PrecipitationO8rawValueACSgSS_tcfc","interfaceLanguage":"swift"},"pathComponents":["Precipitation","init(rawValue:)"],"names":{"title":"init(rawValue:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"rawValue","declarationFragments":[{"kind":"identifier","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}],"accessLevel":"public"},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo10ShapeErrorO","interfaceLanguage":"swift"},"pathComponents":["ShapeError"],"names":{"title":"ShapeError","navigator":[{"kind":"identifier","spelling":"ShapeError"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"ShapeError"}]},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"ShapeError"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":54,"character":12}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:s5ErrorP10FoundationE20localizedDescriptionSSvp::SYNTHESIZED::s:9SwiftDemo10ShapeErrorO","interfaceLanguage":"swift"},"pathComponents":["ShapeError","localizedDescription"],"names":{"title":"localizedDescription","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"localizedDescription"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"docComment":{"module":"Foundation","lines":[{"text":"Retrieve the localized description for this error."}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"localizedDescription"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":8,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":10}},{"domain":"tvOS","introduced":{"major":9,"minor":0}},{"domain":"watchOS","introduced":{"major":2,"minor":0}}]},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo10ShapeErrorO11invalidSideyACSdcACmF","interfaceLanguage":"swift"},"pathComponents":["ShapeError","invalidSide(_:)"],"names":{"title":"ShapeError.invalidSide(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"invalidSide"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"invalidSide"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":55,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo10ShapeErrorO12tooManySidesyACSi_SitcACmF","interfaceLanguage":"swift"},"pathComponents":["ShapeError","tooManySides(count:limit:)"],"names":{"title":"ShapeError.tooManySides(count:limit:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"tooManySides"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"limit"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"tooManySides"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"limit"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":56,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo10ShapeErrorO7unknownyA2CmF","interfaceLanguage":"swift"},"pathComponents":["ShapeError","unknown"],"names":{"title":"ShapeError.unknown","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"unknown"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"unknown"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":57,"character":9}}},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO","interfaceLanguage":"swift"},"pathComponents":["Measurement"],"names":{"title":"Measurement","navigator":[{"kind":"identifier","spelling":"Measurement"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Measurement"}]},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Measurement"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":60,"character":12}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO6lengthyACSdcACmF","interfaceLanguage":"swift"},"pathComponents":["Measurement","length(_:)"],"names":{"title":"Measurement.length(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"length"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"length"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":61,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO4areayACSd_SdtcACmF","interfaceLanguage":"swift"},"pathComponents":["Measurement","area(width:height:)"],"names":{"title":"Measurement.area(width:height:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"width"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"height"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"width"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"height"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":62,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO4noneyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Measurement","none"],"names":{"title":"Measurement.none","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"none"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"none"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":63,"character":9}}},{"kind":{"identifier":"swift.struct","displayName":"Structure"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO4UnitV","interfaceLanguage":"swift"},"pathComponents":["Measurement","Unit"],"names":{"title":"Measurement.Unit","navigator":[{"kind":"identifier","spelling":"Unit"}],"subHeading":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Unit"}]},"declarationFragments":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Unit"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":65,"character":18}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO4UnitV6symbolSSvp","interfaceLanguage":"swift"},"pathComponents":["Measurement","Unit","symbol"],"names":{"title":"symbol","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"symbol"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"symbol"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":66,"character":19}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO4UnitV6symbolAESS_tcfc","interfaceLanguage":"swift"},"pathComponents":["Measurement","Unit","init(symbol:)"],"names":{"title":"init(symbol:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"symbol"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"symbol","declarationFragments":[{"kind":"identifier","spelling":"symbol"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"symbol"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":67,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO6isNoneSbvp","interfaceLanguage":"swift"},"pathComponents":["Measurement","isNone"],"names":{"title":"isNone","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"isNone"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"isNone"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":70,"character":15}}},{"kind":{"identifier":"swift.struct","displayName":"Structure"},"identifier":{"precise":"s:9SwiftDemo4RingV","interfaceLanguage":"swift"},"pathComponents":["Ring"],"names":{"title":"Ring","navigator":[{"kind":"identifier","spelling":"Ring"}],"subHeading":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Ring"}]},"declarationFragments":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Ring"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":76,"character":14}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo4RingV5innerAA5PointVvp","interfaceLanguage":"swift"},"pathComponents":["Ring","inner"],"names":{"title":"inner","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"inner"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"inner"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":77,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo4RingV5outerAA5PointVvp","interfaceLanguage":"swift"},"pathComponents":["Ring","outer"],"names":{"title":"outer","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"outer"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"outer"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":78,"character":15}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo4RingV5inner5outerAcA5PointV_AGtcfc","interfaceLanguage":"swift"},"pathComponents":["Ring","init(inner:outer:)"],"names":{"title":"init(inner:outer:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"inner"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"outer"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"inner","declarationFragments":[{"kind":"identifier","spelling":"inner"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},{"name":"outer","declarationFragments":[{"kind":"identifier","spelling":"outer"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"inner"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"outer"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":80,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo4RingV6expand2byySd_tF","interfaceLanguage":"swift"},"pathComponents":["Ring","expand(by:)"],"names":{"title":"expand(by:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"expand"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"by","internalName":"delta","declarationFragments":[{"kind":"identifier","spelling":"delta"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"mutating"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"expand"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"delta"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":85,"character":25}}},{"kind":{"identifier":"swift.func.op","displayName":"Operator"},"identifier":{"precise":"s:9SwiftDemo4RingV1poiyA2C_ACtFZ","interfaceLanguage":"swift"},"pathComponents":["Ring","+(_:_:)"],"names":{"title":"+(_:_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"+"},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"}]},"functionSignature":{"parameters":[{"name":"lhs","declarationFragments":[{"kind":"identifier","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"}]},{"name":"rhs","declarationFragments":[{"kind":"identifier","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"+"},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"internalParam","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"},{"kind":"text","spelling":", "},{"kind":"internalParam","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":90,"character":23}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter"],"names":{"title":"Counter","navigator":[{"kind":"identifier","spelling":"Counter"}],"subHeading":[{"kind":"keyword","spelling":"actor"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Counter"}]},"declarationFragments":[{"kind":"keyword","spelling":"actor"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Counter"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":95,"character":13}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pqd_0_YKXEqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter","withSerialExecutor(_:)"],"names":{"title":"withSerialExecutor(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withSerialExecutor"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"genericParameter","spelling":"E"},{"kind":"text","spelling":">((any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"}]},"docComment":{"module":"_Concurrency","lines":[{"text":"Perform an operation with the actor's ``SerialExecutor``."},{"text":""},{"text":"This converts the actor's ``Actor/unownedExecutor`` to a ``SerialExecutor`` while"},{"text":"retaining the actor for the duration of the operation. This is to ensure the lifetime"},{"text":"of the executor while performing the operation."}]},"functionSignature":{"parameters":[{"name":"operation","declarationFragments":[{"kind":"identifier","spelling":"operation"},{"kind":"text","spelling":": (any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"}]}],"returns":[{"kind":"typeIdentifier","spelling":"T"}]},"swiftGenerics":{"parameters":[{"name":"T","index":0,"depth":1},{"name":"E","index":1,"depth":1}],"constraints":[{"kind":"conformance","lhs":"E","rhs":"Error","rhsPrecise":"s:s5ErrorP"}]},"swiftExtension":{"extendedModule":"_Concurrency","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withSerialExecutor"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"genericParameter","spelling":"E"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"operation"},{"kind":"text","spelling":": (any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"where"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Error","preciseIdentifier":"s:s5ErrorP"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" : ~Copyable"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":13,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":15}},{"domain":"tvOS","introduced":{"major":13,"minor":0}},{"domain":"watchOS","introduced":{"major":6,"minor":0}}]},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pYaqd_0_YKYCXEYaqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter","withSerialExecutor(_:)"],"names":{"title":"withSerialExecutor(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withSerialExecutor"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"genericParameter","spelling":"E"},{"kind":"text","spelling":">("},{"kind":"keyword","spelling":"nonisolated(nonsending)"},{"kind":"text","spelling":" (any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"}]},"docComment":{"module":"_Concurrency","lines":[{"text":"Perform an operation with the actor's ``SerialExecutor``."},{"text":""},{"text":"This converts the actor's ``Actor/unownedExecutor`` to a ``SerialExecutor`` while"},{"text":"retaining the actor for the duration of the operation. This is to ensure the lifetime"},{"text":"of the executor while performing the operation."}]},"functionSignature":{"parameters":[{"name":"operation","declarationFragments":[{"kind":"identifier","spelling":"operation"},{"kind":"text","spelling":": (any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"}]}],"returns":[{"kind":"typeIdentifier","spelling":"T"}]},"swiftGenerics":{"parameters":[{"name":"T","index":0,"depth":1},{"name":"E","index":1,"depth":1}],"constraints":[{"kind":"conformance","lhs":"E","rhs":"Error","rhsPrecise":"s:s5ErrorP"}]},"swiftExtension":{"extendedModule":"_Concurrency","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withSerialExecutor"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"genericParameter","spelling":"E"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"operation"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"nonisolated(nonsending)"},{"kind":"text","spelling":" (any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"where"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Error","preciseIdentifier":"s:s5ErrorP"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" : ~Copyable"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":13,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":15}},{"domain":"tvOS","introduced":{"major":13,"minor":0}},{"domain":"watchOS","introduced":{"major":6,"minor":0}}]},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:ScA12_ConcurrencyE20preconditionIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter","preconditionIsolated(_:file:line:)"],"names":{"title":"preconditionIsolated(_:file:line:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"preconditionIsolated"},{"kind":"text","spelling":"("},{"kind":"attribute","spelling":"@autoclosure "},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":")"}]},"docComment":{"module":"_Concurrency","lines":[{"text":"Stops program execution if the current task is not executing on this"},{"text":"actor's serial executor."},{"text":""},{"text":"This function's effect varies depending on the build flag used:"},{"text":""},{"text":"* In playgrounds and `-Onone` builds (the default for Xcode's Debug"},{"text":" configuration), stops program execution in a debuggable state after"},{"text":" printing `message`."},{"text":""},{"text":"* In `-O` builds (the default for Xcode's Release configuration), stops"},{"text":" program execution."},{"text":""},{"text":"- Note: Because this check is performed against the actor's serial executor,"},{"text":" if another actor uses the same serial executor--by using"},{"text":" that actor's serial executor as its own ``Actor/unownedExecutor``--this"},{"text":" check will succeed. From a concurrency safety perspective, the"},{"text":" serial executor guarantees mutual exclusion of those two actors."},{"text":""},{"text":"- Parameters:"},{"text":" - message: The message to print if the assertion fails."},{"text":" - file: The file name to print if the assertion fails. The default is"},{"text":" where this method was called."},{"text":" - line: The line number to print if the assertion fails The default is"},{"text":" where this method was called."}]},"functionSignature":{"parameters":[{"name":"message","declarationFragments":[{"kind":"identifier","spelling":"message"},{"kind":"text","spelling":": () -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"file","declarationFragments":[{"kind":"identifier","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"}]},{"name":"line","declarationFragments":[{"kind":"identifier","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"}]}],"returns":[{"kind":"text","spelling":"()"}]},"swiftExtension":{"extendedModule":"_Concurrency","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"text","spelling":"@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)\n"},{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"preconditionIsolated"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"message"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@autoclosure "},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" = String(), "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#fileID"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#line"},{"kind":"text","spelling":")"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":13,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":15}},{"domain":"tvOS","introduced":{"major":13,"minor":0}},{"domain":"watchOS","introduced":{"major":6,"minor":0}}]},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:ScA12_ConcurrencyE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter","assertIsolated(_:file:line:)"],"names":{"title":"assertIsolated(_:file:line:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"assertIsolated"},{"kind":"text","spelling":"("},{"kind":"attribute","spelling":"@autoclosure "},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":")"}]},"docComment":{"module":"_Concurrency","lines":[{"text":"Stops program execution if the current task is not executing on this"},{"text":"actor's serial executor."},{"text":""},{"text":"This function's effect varies depending on the build flag used:"},{"text":""},{"text":"* In playgrounds and `-Onone` builds (the default for Xcode's Debug"},{"text":" configuration), stops program execution in a debuggable state after"},{"text":" printing `message`."},{"text":""},{"text":"* In `-O` builds (the default for Xcode's Release configuration),"},{"text":" the isolation check is not performed and there are no effects."},{"text":""},{"text":"- Note: This check is performed against the actor's serial executor,"},{"text":" meaning that / if another actor uses the same serial executor--by using"},{"text":" that actor's serial executor as its own ``Actor/unownedExecutor``--this"},{"text":" check will succeed , as from a concurrency safety perspective, the"},{"text":" serial executor guarantees mutual exclusion of those two actors."},{"text":""},{"text":"- Parameters:"},{"text":" - message: The message to print if the assertion fails."},{"text":" - file: The file name to print if the assertion fails. The default is"},{"text":" where this method was called."},{"text":" - line: The line number to print if the assertion fails The default is"},{"text":" where this method was called."}]},"functionSignature":{"parameters":[{"name":"message","declarationFragments":[{"kind":"identifier","spelling":"message"},{"kind":"text","spelling":": () -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"file","declarationFragments":[{"kind":"identifier","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"}]},{"name":"line","declarationFragments":[{"kind":"identifier","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"}]}],"returns":[{"kind":"text","spelling":"()"}]},"swiftExtension":{"extendedModule":"_Concurrency","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"text","spelling":"@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)\n"},{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"assertIsolated"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"message"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@autoclosure "},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" = String(), "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#fileID"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#line"},{"kind":"text","spelling":")"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":13,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":15}},{"domain":"tvOS","introduced":{"major":13,"minor":0}},{"domain":"watchOS","introduced":{"major":6,"minor":0}}]},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:ScA12_ConcurrencyE14assumeIsolated_4file4lineqd__qd__xYiKXE_s12StaticStringVSutKs8SendableRd__lF::SYNTHESIZED::s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter","assumeIsolated(_:file:line:)"],"names":{"title":"assumeIsolated(_:file:line:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"assumeIsolated"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":">(("},{"kind":"keyword","spelling":"isolated"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"rethrows"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"T"}]},"docComment":{"module":"_Concurrency","lines":[{"text":"Assume that the current task is executing on this actor's serial executor,"},{"text":"or stop program execution otherwise."},{"text":""},{"text":"You call this method to *assume and verify* that the currently"},{"text":"executing synchronous function is actually executing on the serial"},{"text":"executor of this actor."},{"text":""},{"text":"If that is the case, the operation is invoked with an `isolated` version"},{"text":"of the actor, allowing synchronous access to actor local state without"},{"text":"hopping through asynchronous boundaries."},{"text":""},{"text":"If the current context is not running on the actor's serial executor, or"},{"text":"if the actor is a reference to a remote actor, this method will crash"},{"text":"with a fatal error (similar to ``preconditionIsolated(_:file:line:)``)."},{"text":""},{"text":"Note that this check is performed against the passed in actor's serial"},{"text":"executor, meaning that if another actor uses the same serial executor--by"},{"text":"using that actor's ``Actor/unownedExecutor`` as its own"},{"text":"``Actor/unownedExecutor``--this check will succeed, as from a concurrency"},{"text":"safety perspective, the serial executor guarantees mutual exclusion of"},{"text":"those two actors."},{"text":""},{"text":"This method can only be used from synchronous functions, as asynchronous"},{"text":"functions should instead perform a normal method call to the actor, which"},{"text":"will hop task execution to the target actor if necessary."},{"text":""},{"text":"- Note: This check is performed against the actor's serial executor,"},{"text":" meaning that / if another actor uses the same serial executor--by using"},{"text":" another actor's executor as its own ``Actor/unownedExecutor``"},{"text":" --this check will succeed , as from a concurrency safety perspective,"},{"text":" the serial executor guarantees mutual exclusion of those two actors."},{"text":""},{"text":"- Parameters:"},{"text":" - operation: the operation that will be executed if the current context"},{"text":" is executing on the actors serial executor."},{"text":" - file: The file name to print if the assertion fails. The default is"},{"text":" where this method was called."},{"text":" - line: The line number to print if the assertion fails The default is"},{"text":" where this method was called."},{"text":"- Returns: the return value of the `operation`"},{"text":"- Throws: rethrows the `Error` thrown by the operation if it threw"}]},"functionSignature":{"parameters":[{"name":"operation","declarationFragments":[{"kind":"identifier","spelling":"operation"},{"kind":"text","spelling":": ("},{"kind":"keyword","spelling":"isolated"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"T"}]},{"name":"file","declarationFragments":[{"kind":"identifier","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"}]},{"name":"line","declarationFragments":[{"kind":"identifier","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"}]}],"returns":[{"kind":"typeIdentifier","spelling":"T"}]},"swiftGenerics":{"parameters":[{"name":"T","index":0,"depth":1}],"constraints":[{"kind":"conformance","lhs":"T","rhs":"Sendable","rhsPrecise":"s:s8SendableP"}]},"swiftExtension":{"extendedModule":"_Concurrency","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"assumeIsolated"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"operation"},{"kind":"text","spelling":": ("},{"kind":"keyword","spelling":"isolated"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#fileID"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#line"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"rethrows"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"where"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Sendable","preciseIdentifier":"s:s8SendableP"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":13,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":15}},{"domain":"tvOS","introduced":{"major":13,"minor":0}},{"domain":"watchOS","introduced":{"major":6,"minor":0}}]},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7CounterC5valueSivp","interfaceLanguage":"swift"},"pathComponents":["Counter","value"],"names":{"title":"value","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { get }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":96,"character":28}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7CounterCACycfc","interfaceLanguage":"swift"},"pathComponents":["Counter","init()"],"names":{"title":"init()","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}]},"functionSignature":{},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":97,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7CounterC9incrementSiyF","interfaceLanguage":"swift"},"pathComponents":["Counter","increment()"],"names":{"title":"increment()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"increment"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"increment"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":98,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7CounterC5labelSSyF","interfaceLanguage":"swift"},"pathComponents":["Counter","label()"],"names":{"title":"label()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"label"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"label"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":102,"character":28}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo6CanvasC","interfaceLanguage":"swift"},"pathComponents":["Canvas"],"names":{"title":"Canvas","navigator":[{"kind":"identifier","spelling":"Canvas"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Canvas"}]},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Canvas"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":106,"character":19}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo6CanvasCACycfc","interfaceLanguage":"swift"},"pathComponents":["Canvas","init()"],"names":{"title":"init()","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}]},"functionSignature":{},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":107,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6CanvasC4drawyyAA5Shape_pF","interfaceLanguage":"swift"},"pathComponents":["Canvas","draw(_:)"],"names":{"title":"draw(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"draw"},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"any"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Shape","preciseIdentifier":"s:9SwiftDemo5ShapeP"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"shape","declarationFragments":[{"kind":"identifier","spelling":"shape"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"any"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Shape","preciseIdentifier":"s:9SwiftDemo5ShapeP"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"draw"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"shape"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"any"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Shape","preciseIdentifier":"s:9SwiftDemo5ShapeP"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":108,"character":16}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo6LoaderC","interfaceLanguage":"swift"},"pathComponents":["Loader"],"names":{"title":"Loader","navigator":[{"kind":"identifier","spelling":"Loader"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Loader"}]},"declarationFragments":[{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Loader"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":111,"character":19}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo6LoaderCACycfc","interfaceLanguage":"swift"},"pathComponents":["Loader","init()"],"names":{"title":"init()","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}]},"functionSignature":{},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":112,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC4load4path10Foundation4DataVSS_tKF","interfaceLanguage":"swift"},"pathComponents":["Loader","load(path:)"],"names":{"title":"load(path:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"load"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"path"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"}]},"functionSignature":{"parameters":[{"name":"path","declarationFragments":[{"kind":"identifier","spelling":"path"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"load"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"path"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":114,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC5fetch3urlSS10Foundation3URLV_tYaKF","interfaceLanguage":"swift"},"pathComponents":["Loader","fetch(url:)"],"names":{"title":"fetch(url:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"fetch"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"url"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"url","declarationFragments":[{"kind":"identifier","spelling":"url"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"fetch"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"url"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":115,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC4wait7secondsySd_tYaF","interfaceLanguage":"swift"},"pathComponents":["Loader","wait(seconds:)"],"names":{"title":"wait(seconds:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"wait"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"seconds"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"}]},"functionSignature":{"parameters":[{"name":"seconds","declarationFragments":[{"kind":"identifier","spelling":"seconds"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"wait"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"seconds"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":116,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF","interfaceLanguage":"swift"},"pathComponents":["Loader","transform(_:)"],"names":{"title":"transform(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"transform"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":">("},{"kind":"typeIdentifier","spelling":"T","preciseIdentifier":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF1TL_xmfp"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T","preciseIdentifier":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF1TL_xmfp"}]},"functionSignature":{"parameters":[{"name":"shape","declarationFragments":[{"kind":"identifier","spelling":"shape"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"T","preciseIdentifier":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF1TL_xmfp"}]}],"returns":[{"kind":"typeIdentifier","spelling":"T"}]},"swiftGenerics":{"parameters":[{"name":"T","index":0,"depth":0}],"constraints":[{"kind":"conformance","lhs":"T","rhs":"Shape","rhsPrecise":"s:9SwiftDemo5ShapeP"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"transform"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"shape"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"T","preciseIdentifier":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF1TL_xmfp"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T","preciseIdentifier":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF1TL_xmfp"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"where"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Shape","preciseIdentifier":"s:9SwiftDemo5ShapeP"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":118,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF","interfaceLanguage":"swift"},"pathComponents":["Loader","first(of:)"],"names":{"title":"first(of:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"first"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"Element"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Element","preciseIdentifier":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF7ElementL_xmfp"},{"kind":"text","spelling":"]) -> "},{"kind":"typeIdentifier","spelling":"Element","preciseIdentifier":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF7ElementL_xmfp"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"of","internalName":"items","declarationFragments":[{"kind":"identifier","spelling":"items"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Element","preciseIdentifier":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF7ElementL_xmfp"},{"kind":"text","spelling":"]"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Element"},{"kind":"text","spelling":"?"}]},"swiftGenerics":{"parameters":[{"name":"Element","index":0,"depth":0}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"first"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"Element"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"items"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Element","preciseIdentifier":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF7ElementL_xmfp"},{"kind":"text","spelling":"]) -> "},{"kind":"typeIdentifier","spelling":"Element","preciseIdentifier":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF7ElementL_xmfp"},{"kind":"text","spelling":"?"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":119,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC14withCompletionyyys6ResultOySSAA10ShapeErrorOGcF","interfaceLanguage":"swift"},"pathComponents":["Loader","withCompletion(_:)"],"names":{"title":"withCompletion(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withCompletion"},{"kind":"text","spelling":"(("},{"kind":"typeIdentifier","spelling":"Result","preciseIdentifier":"s:s6ResultO"},{"kind":"text","spelling":"<"},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"ShapeError","preciseIdentifier":"s:9SwiftDemo10ShapeErrorO"},{"kind":"text","spelling":">) -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"completion","declarationFragments":[{"kind":"identifier","spelling":"completion"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@escaping"},{"kind":"text","spelling":" ("},{"kind":"typeIdentifier","spelling":"Result","preciseIdentifier":"s:s6ResultO"},{"kind":"text","spelling":"<"},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"ShapeError","preciseIdentifier":"s:9SwiftDemo10ShapeErrorO"},{"kind":"text","spelling":">) -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withCompletion"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"completion"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@escaping"},{"kind":"text","spelling":" ("},{"kind":"typeIdentifier","spelling":"Result","preciseIdentifier":"s:s6ResultO"},{"kind":"text","spelling":"<"},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"ShapeError","preciseIdentifier":"s:9SwiftDemo10ShapeErrorO"},{"kind":"text","spelling":">) -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":121,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC4eachyyySiXEF","interfaceLanguage":"swift"},"pathComponents":["Loader","each(_:)"],"names":{"title":"each(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"each"},{"kind":"text","spelling":"(("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"body","declarationFragments":[{"kind":"identifier","spelling":"body"},{"kind":"text","spelling":": ("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"each"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"body"},{"kind":"text","spelling":": ("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":122,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC6lookup5table3keySiSgSDySSSiG_SStF","interfaceLanguage":"swift"},"pathComponents":["Loader","lookup(table:key:)"],"names":{"title":"lookup(table:key:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"lookup"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"table"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"], "},{"kind":"externalParam","spelling":"key"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"table","declarationFragments":[{"kind":"identifier","spelling":"table"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}]},{"name":"key","declarationFragments":[{"kind":"identifier","spelling":"key"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"?"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"lookup"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"table"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"], "},{"kind":"externalParam","spelling":"key"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"?"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":124,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC6updateyyAA5PointVzF","interfaceLanguage":"swift"},"pathComponents":["Loader","update(_:)"],"names":{"title":"update(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"update"},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"point","declarationFragments":[{"kind":"identifier","spelling":"point"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"update"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"point"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":126,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC10modernOnlyyyF","interfaceLanguage":"swift"},"pathComponents":["Loader","modernOnly()"],"names":{"title":"modernOnly()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"modernOnly"},{"kind":"text","spelling":"()"}]},"functionSignature":{"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"modernOnly"},{"kind":"text","spelling":"()"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":16,"minor":0}}],"location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":129,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC11legacyFetchyyF","interfaceLanguage":"swift"},"pathComponents":["Loader","legacyFetch()"],"names":{"title":"legacyFetch()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"legacyFetch"},{"kind":"text","spelling":"()"}]},"functionSignature":{"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"legacyFetch"},{"kind":"text","spelling":"()"}],"accessLevel":"public","availability":[{"domain":"*","message":"Use fetch(url:) instead","isUnconditionallyDeprecated":true}],"location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":132,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC8oldFetchyyF","interfaceLanguage":"swift"},"pathComponents":["Loader","oldFetch()"],"names":{"title":"oldFetch()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"oldFetch"},{"kind":"text","spelling":"()"}]},"functionSignature":{"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"oldFetch"},{"kind":"text","spelling":"()"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":15,"minor":0},"deprecated":{"major":17,"minor":0},"renamed":"fetch(url:)"}],"location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":135,"character":16}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo16makeDefaultPointAA0E0VyF","interfaceLanguage":"swift"},"pathComponents":["makeDefaultPoint()"],"names":{"title":"makeDefaultPoint()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeDefaultPoint"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeDefaultPoint"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":138,"character":12}}},{"kind":{"identifier":"swift.var","displayName":"Global Variable"},"identifier":{"precise":"s:9SwiftDemo13defaultFlavorAA0D0Ovp","interfaceLanguage":"swift"},"pathComponents":["defaultFlavor"],"names":{"title":"defaultFlavor","subHeading":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"defaultFlavor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Flavor","preciseIdentifier":"s:9SwiftDemo6FlavorO"}]},"declarationFragments":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"defaultFlavor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Flavor","preciseIdentifier":"s:9SwiftDemo6FlavorO"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":139,"character":11}}},{"kind":{"identifier":"swift.var","displayName":"Global Variable"},"identifier":{"precise":"s:9SwiftDemo13globalCounterSivp","interfaceLanguage":"swift"},"pathComponents":["globalCounter"],"names":{"title":"globalCounter","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"globalCounter"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"globalCounter"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":140,"character":11}}},{"kind":{"identifier":"swift.typealias","displayName":"Type Alias"},"identifier":{"precise":"s:9SwiftDemo11Coordinatesa","interfaceLanguage":"swift"},"pathComponents":["Coordinates"],"names":{"title":"Coordinates","navigator":[{"kind":"identifier","spelling":"Coordinates"}],"subHeading":[{"kind":"keyword","spelling":"typealias"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Coordinates"}]},"declarationFragments":[{"kind":"keyword","spelling":"typealias"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Coordinates"},{"kind":"text","spelling":" = (latitude"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", longitude"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":141,"character":17}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo11checkedSideyS2dKF","interfaceLanguage":"swift"},"pathComponents":["checkedSide(_:)"],"names":{"title":"checkedSide(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"checkedSide"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"functionSignature":{"parameters":[{"name":"side","declarationFragments":[{"kind":"identifier","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"checkedSide"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":3,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo8echoInt8ys0D0VADF","interfaceLanguage":"swift"},"pathComponents":["echoInt8(_:)"],"names":{"title":"echoInt8(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"echoInt8"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"}]},"functionSignature":{"parameters":[{"name":"value","declarationFragments":[{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"echoInt8"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":8,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo10echoUInt64ys0D0VADF","interfaceLanguage":"swift"},"pathComponents":["echoUInt64(_:)"],"names":{"title":"echoUInt64(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"echoUInt64"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"}]},"functionSignature":{"parameters":[{"name":"value","declarationFragments":[{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"}]}],"returns":[{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"echoUInt64"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":9,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo10largestIntSiyF","interfaceLanguage":"swift"},"pathComponents":["largestInt()"],"names":{"title":"largestInt()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"largestInt"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"largestInt"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":10,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo5shoutySSSgACF","interfaceLanguage":"swift"},"pathComponents":["shout(_:)"],"names":{"title":"shout(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"shout"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"shout"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":11,"character":12}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo7TrackerC","interfaceLanguage":"swift"},"pathComponents":["Tracker"],"names":{"title":"Tracker","navigator":[{"kind":"identifier","spelling":"Tracker"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Tracker"}]},"declarationFragments":[{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Tracker"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":13,"character":19}}},{"kind":{"identifier":"swift.type.property","displayName":"Type Property"},"identifier":{"precise":"s:9SwiftDemo7TrackerC9liveCountSivpZ","interfaceLanguage":"swift"},"pathComponents":["Tracker","liveCount"],"names":{"title":"liveCount","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"liveCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"liveCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { get }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":14,"character":35}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7TrackerC2idSivp","interfaceLanguage":"swift"},"pathComponents":["Tracker","id"],"names":{"title":"id","subHeading":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":15,"character":15}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7TrackerC2idACSi_tcfc","interfaceLanguage":"swift"},"pathComponents":["Tracker","init(id:)"],"names":{"title":"init(id:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"id","declarationFragments":[{"kind":"identifier","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":17,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7TrackerC4sameACyF","interfaceLanguage":"swift"},"pathComponents":["Tracker","same()"],"names":{"title":"same()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"same"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"same"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":24,"character":16}}}],"relationships":[{"kind":"requirementOf","source":"s:9SwiftDemo7GreeterP5greet4nameS2S_tF","target":"s:9SwiftDemo7GreeterP"},{"kind":"conformsTo","source":"s:9SwiftDemo0B0C","target":"s:9SwiftDemo7GreeterP"},{"kind":"memberOf","source":"s:9SwiftDemo0B0CACycfc","target":"s:9SwiftDemo0B0C"},{"kind":"memberOf","source":"s:9SwiftDemo0B0C5greet4nameS2S_tF","target":"s:9SwiftDemo0B0C","sourceOrigin":{"identifier":"s:9SwiftDemo7GreeterP5greet4nameS2S_tF","displayName":"Greeter.greet(name:)"}},{"kind":"conformsTo","source":"s:9SwiftDemo5PointV","target":"s:s23CustomStringConvertibleP","targetFallback":"Swift.CustomStringConvertible"},{"kind":"memberOf","source":"s:9SwiftDemo5PointV1xSdvp","target":"s:9SwiftDemo5PointV"},{"kind":"memberOf","source":"s:9SwiftDemo5PointV1ySdvp","target":"s:9SwiftDemo5PointV"},{"kind":"memberOf","source":"s:9SwiftDemo5PointV1x1yACSd_Sdtcfc","target":"s:9SwiftDemo5PointV"},{"kind":"memberOf","source":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo6FlavorO","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp","displayName":"RawRepresentable.hashValue"}},{"kind":"memberOf","source":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo6FlavorO","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF","displayName":"RawRepresentable.hash(into:)"}},{"kind":"memberOf","source":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ","displayName":"Equatable.!=(_:_:)"}},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:SQ","targetFallback":"Swift.Equatable"},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:SH","targetFallback":"Swift.Hashable"},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:SY","targetFallback":"Swift.RawRepresentable"},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:s23CustomStringConvertibleP","targetFallback":"Swift.CustomStringConvertible"},{"kind":"memberOf","source":"s:9SwiftDemo6FlavorO7vanillayA2CmF","target":"s:9SwiftDemo6FlavorO"},{"kind":"memberOf","source":"s:9SwiftDemo6FlavorO9chocolateyA2CmF","target":"s:9SwiftDemo6FlavorO"},{"kind":"memberOf","source":"s:9SwiftDemo6FlavorO8rawValueACSgSi_tcfc","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:SY8rawValuexSg03RawB0Qz_tcfc","displayName":"RawRepresentable.init(rawValue:)"}},{"kind":"memberOf","source":"s:9SwiftDemo0B0C5greet4name5timesS2S_SitF","target":"s:9SwiftDemo0B0C"},{"kind":"memberOf","source":"s:9SwiftDemo0B0C7versionSSvpZ","target":"s:9SwiftDemo0B0C"},{"kind":"conformsTo","source":"s:9SwiftDemo5PointV","target":"s:s9EscapableP","targetFallback":"Swift.Escapable"},{"kind":"conformsTo","source":"s:9SwiftDemo5PointV","target":"s:s8CopyableP","targetFallback":"Swift.Copyable"},{"kind":"memberOf","source":"s:9SwiftDemo5PointV11descriptionSSvp","target":"s:9SwiftDemo5PointV","sourceOrigin":{"identifier":"s:s23CustomStringConvertibleP11descriptionSSvp","displayName":"CustomStringConvertible.description"}},{"kind":"memberOf","source":"s:9SwiftDemo5PointV6lengthSdvp","target":"s:9SwiftDemo5PointV"},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:s9EscapableP","targetFallback":"Swift.Escapable"},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:s8CopyableP","targetFallback":"Swift.Copyable"},{"kind":"memberOf","source":"s:9SwiftDemo6FlavorO11descriptionSSvp","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:s23CustomStringConvertibleP11descriptionSSvp","displayName":"CustomStringConvertible.description"}},{"kind":"conformsTo","source":"s:9SwiftDemo5ShapeP","target":"s:9SwiftDemo7GreeterP"},{"kind":"requirementOf","source":"s:9SwiftDemo5ShapeP4areaSdvp","target":"s:9SwiftDemo5ShapeP"},{"kind":"requirementOf","source":"s:9SwiftDemo5ShapeP5sidesSivpZ","target":"s:9SwiftDemo5ShapeP"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC4nameSSvp","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC11vertexCountSivp","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC6sharedACvpZ","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC4name11vertexCountACSS_Sitcfc","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC4nameACSgSS_tcfc","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5scale2byySd_tF","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5scale2byySi_tF","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5scale1x1yySd_SdtF","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC4makeACyFZ","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC8describeySSACSgFZ","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonCyAA5PointVSicip","target":"s:9SwiftDemo7PolygonC"},{"kind":"conformsTo","source":"s:9SwiftDemo6SquareC","target":"s:9SwiftDemo5ShapeP"},{"kind":"conformsTo","source":"s:9SwiftDemo6SquareC","target":"s:9SwiftDemo7GreeterP"},{"kind":"inheritsFrom","source":"s:9SwiftDemo6SquareC","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC4sideSdvp","target":"s:9SwiftDemo6SquareC"},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC4sideACSd_tcfc","target":"s:9SwiftDemo6SquareC"},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC4areaSdvp","target":"s:9SwiftDemo6SquareC","sourceOrigin":{"identifier":"s:9SwiftDemo5ShapeP4areaSdvp","displayName":"Shape.area"}},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC5sidesSivpZ","target":"s:9SwiftDemo6SquareC","sourceOrigin":{"identifier":"s:9SwiftDemo5ShapeP5sidesSivpZ","displayName":"Shape.sides"}},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC5greet4nameS2S_tF","target":"s:9SwiftDemo6SquareC","sourceOrigin":{"identifier":"s:9SwiftDemo7GreeterP5greet4nameS2S_tF","displayName":"Greeter.greet(name:)"}},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC5scale2byySd_tF","target":"s:9SwiftDemo6SquareC"},{"kind":"overrides","source":"s:9SwiftDemo6SquareC5scale2byySd_tF","target":"s:9SwiftDemo7PolygonC5scale2byySd_tF"},{"kind":"memberOf","source":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","target":"s:9SwiftDemo13PrecipitationO","sourceOrigin":{"identifier":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp","displayName":"RawRepresentable.hashValue"}},{"kind":"memberOf","source":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","target":"s:9SwiftDemo13PrecipitationO","sourceOrigin":{"identifier":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF","displayName":"RawRepresentable.hash(into:)"}},{"kind":"memberOf","source":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","target":"s:9SwiftDemo13PrecipitationO","sourceOrigin":{"identifier":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ","displayName":"Equatable.!=(_:_:)"}},{"kind":"conformsTo","source":"s:9SwiftDemo13PrecipitationO","target":"s:SQ","targetFallback":"Swift.Equatable"},{"kind":"conformsTo","source":"s:9SwiftDemo13PrecipitationO","target":"s:SH","targetFallback":"Swift.Hashable"},{"kind":"conformsTo","source":"s:9SwiftDemo13PrecipitationO","target":"s:SY","targetFallback":"Swift.RawRepresentable"},{"kind":"memberOf","source":"s:9SwiftDemo13PrecipitationO4rainyA2CmF","target":"s:9SwiftDemo13PrecipitationO"},{"kind":"memberOf","source":"s:9SwiftDemo13PrecipitationO4snowyA2CmF","target":"s:9SwiftDemo13PrecipitationO"},{"kind":"memberOf","source":"s:9SwiftDemo13PrecipitationO4noneyA2CmF","target":"s:9SwiftDemo13PrecipitationO"},{"kind":"memberOf","source":"s:9SwiftDemo13PrecipitationO8rawValueACSgSS_tcfc","target":"s:9SwiftDemo13PrecipitationO","sourceOrigin":{"identifier":"s:SY8rawValuexSg03RawB0Qz_tcfc","displayName":"RawRepresentable.init(rawValue:)"}},{"kind":"memberOf","source":"s:s5ErrorP10FoundationE20localizedDescriptionSSvp::SYNTHESIZED::s:9SwiftDemo10ShapeErrorO","target":"s:9SwiftDemo10ShapeErrorO","sourceOrigin":{"identifier":"s:s5ErrorP10FoundationE20localizedDescriptionSSvp","displayName":"Error.localizedDescription"}},{"kind":"conformsTo","source":"s:9SwiftDemo10ShapeErrorO","target":"s:s5ErrorP","targetFallback":"Swift.Error"},{"kind":"conformsTo","source":"s:9SwiftDemo10ShapeErrorO","target":"s:s8SendableP","targetFallback":"Swift.Sendable"},{"kind":"conformsTo","source":"s:9SwiftDemo10ShapeErrorO","target":"s:s16SendableMetatypeP","targetFallback":"Swift.SendableMetatype"},{"kind":"memberOf","source":"s:9SwiftDemo10ShapeErrorO11invalidSideyACSdcACmF","target":"s:9SwiftDemo10ShapeErrorO"},{"kind":"memberOf","source":"s:9SwiftDemo10ShapeErrorO12tooManySidesyACSi_SitcACmF","target":"s:9SwiftDemo10ShapeErrorO"},{"kind":"memberOf","source":"s:9SwiftDemo10ShapeErrorO7unknownyA2CmF","target":"s:9SwiftDemo10ShapeErrorO"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO6lengthyACSdcACmF","target":"s:9SwiftDemo11MeasurementO"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO4areayACSd_SdtcACmF","target":"s:9SwiftDemo11MeasurementO"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO4noneyA2CmF","target":"s:9SwiftDemo11MeasurementO"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO4UnitV","target":"s:9SwiftDemo11MeasurementO"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO4UnitV6symbolSSvp","target":"s:9SwiftDemo11MeasurementO4UnitV"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO4UnitV6symbolAESS_tcfc","target":"s:9SwiftDemo11MeasurementO4UnitV"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO6isNoneSbvp","target":"s:9SwiftDemo11MeasurementO"},{"kind":"memberOf","source":"s:9SwiftDemo4RingV5innerAA5PointVvp","target":"s:9SwiftDemo4RingV"},{"kind":"memberOf","source":"s:9SwiftDemo4RingV5outerAA5PointVvp","target":"s:9SwiftDemo4RingV"},{"kind":"memberOf","source":"s:9SwiftDemo4RingV5inner5outerAcA5PointV_AGtcfc","target":"s:9SwiftDemo4RingV"},{"kind":"memberOf","source":"s:9SwiftDemo4RingV6expand2byySd_tF","target":"s:9SwiftDemo4RingV"},{"kind":"memberOf","source":"s:9SwiftDemo4RingV1poiyA2C_ACtFZ","target":"s:9SwiftDemo4RingV"},{"kind":"memberOf","source":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pqd_0_YKXEqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SwiftDemo7CounterC","target":"s:9SwiftDemo7CounterC","sourceOrigin":{"identifier":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pqd_0_YKXEqd_0_YKs5ErrorRd_0_Ri_d__r0_lF","displayName":"Actor.withSerialExecutor(_:)"}},{"kind":"memberOf","source":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pYaqd_0_YKYCXEYaqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SwiftDemo7CounterC","target":"s:9SwiftDemo7CounterC","sourceOrigin":{"identifier":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pYaqd_0_YKYCXEYaqd_0_YKs5ErrorRd_0_Ri_d__r0_lF","displayName":"Actor.withSerialExecutor(_:)"}},{"kind":"memberOf","source":"s:ScA12_ConcurrencyE20preconditionIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SwiftDemo7CounterC","target":"s:9SwiftDemo7CounterC","sourceOrigin":{"identifier":"s:ScA12_ConcurrencyE20preconditionIsolated_4file4lineySSyXK_s12StaticStringVSutF","displayName":"Actor.preconditionIsolated(_:file:line:)"}},{"kind":"memberOf","source":"s:ScA12_ConcurrencyE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SwiftDemo7CounterC","target":"s:9SwiftDemo7CounterC","sourceOrigin":{"identifier":"s:ScA12_ConcurrencyE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF","displayName":"Actor.assertIsolated(_:file:line:)"}},{"kind":"memberOf","source":"s:ScA12_ConcurrencyE14assumeIsolated_4file4lineqd__qd__xYiKXE_s12StaticStringVSutKs8SendableRd__lF::SYNTHESIZED::s:9SwiftDemo7CounterC","target":"s:9SwiftDemo7CounterC","sourceOrigin":{"identifier":"s:ScA12_ConcurrencyE14assumeIsolated_4file4lineqd__qd__xYiKXE_s12StaticStringVSutKs8SendableRd__lF","displayName":"Actor.assumeIsolated(_:file:line:)"}},{"kind":"conformsTo","source":"s:9SwiftDemo7CounterC","target":"s:ScA","targetFallback":"_Concurrency.Actor"},{"kind":"conformsTo","source":"s:9SwiftDemo7CounterC","target":"s:s8SendableP","targetFallback":"Swift.Sendable"},{"kind":"conformsTo","source":"s:9SwiftDemo7CounterC","target":"s:s16SendableMetatypeP","targetFallback":"Swift.SendableMetatype"},{"kind":"memberOf","source":"s:9SwiftDemo7CounterC5valueSivp","target":"s:9SwiftDemo7CounterC"},{"kind":"memberOf","source":"s:9SwiftDemo7CounterCACycfc","target":"s:9SwiftDemo7CounterC"},{"kind":"memberOf","source":"s:9SwiftDemo7CounterC9incrementSiyF","target":"s:9SwiftDemo7CounterC"},{"kind":"memberOf","source":"s:9SwiftDemo7CounterC5labelSSyF","target":"s:9SwiftDemo7CounterC"},{"kind":"conformsTo","source":"s:9SwiftDemo6CanvasC","target":"s:s8SendableP","targetFallback":"Swift.Sendable"},{"kind":"memberOf","source":"s:9SwiftDemo6CanvasCACycfc","target":"s:9SwiftDemo6CanvasC"},{"kind":"memberOf","source":"s:9SwiftDemo6CanvasC4drawyyAA5Shape_pF","target":"s:9SwiftDemo6CanvasC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderCACycfc","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC4load4path10Foundation4DataVSS_tKF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC5fetch3urlSS10Foundation3URLV_tYaKF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC4wait7secondsySd_tYaF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC14withCompletionyyys6ResultOySSAA10ShapeErrorOGcF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC4eachyyySiXEF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC6lookup5table3keySiSgSDySSSiG_SStF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC6updateyyAA5PointVzF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC10modernOnlyyyF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC11legacyFetchyyF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC8oldFetchyyF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo7TrackerC9liveCountSivpZ","target":"s:9SwiftDemo7TrackerC"},{"kind":"memberOf","source":"s:9SwiftDemo7TrackerC2idSivp","target":"s:9SwiftDemo7TrackerC"},{"kind":"memberOf","source":"s:9SwiftDemo7TrackerC2idACSi_tcfc","target":"s:9SwiftDemo7TrackerC"},{"kind":"memberOf","source":"s:9SwiftDemo7TrackerC4sameACyF","target":"s:9SwiftDemo7TrackerC"}]} \ No newline at end of file +{"metadata":{"formatVersion":{"major":0,"minor":6,"patch":0},"generator":"Apple Swift version 6.4 (swiftlang-6.4.0.34.1 clang-2100.3.34.1)"},"module":{"name":"SwiftDemo","platform":{"architecture":"arm64","environment":"simulator","vendor":"apple","operatingSystem":{"name":"ios","minimumVersion":{"major":15,"minor":0}}}},"symbols":[{"kind":{"identifier":"swift.protocol","displayName":"Protocol"},"identifier":{"precise":"s:9SwiftDemo7GreeterP","interfaceLanguage":"swift"},"pathComponents":["Greeter"],"names":{"title":"Greeter","navigator":[{"kind":"identifier","spelling":"Greeter"}],"subHeading":[{"kind":"keyword","spelling":"protocol"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Greeter"}]},"declarationFragments":[{"kind":"keyword","spelling":"protocol"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Greeter"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":0,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7GreeterP5greet4nameS2S_tF","interfaceLanguage":"swift"},"pathComponents":["Greeter","greet(name:)"],"names":{"title":"greet(name:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":1,"character":9}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo0B0C","interfaceLanguage":"swift"},"pathComponents":["Demo"],"names":{"title":"Demo","navigator":[{"kind":"identifier","spelling":"Demo"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Demo"}]},"declarationFragments":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Demo"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":4,"character":13}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo0B0CACycfc","interfaceLanguage":"swift"},"pathComponents":["Demo","init()"],"names":{"title":"init()","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}]},"functionSignature":{},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":5,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo0B0C5greet4nameS2S_tF","interfaceLanguage":"swift"},"pathComponents":["Demo","greet(name:)"],"names":{"title":"greet(name:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":6,"character":16}}},{"kind":{"identifier":"swift.struct","displayName":"Structure"},"identifier":{"precise":"s:9SwiftDemo5PointV","interfaceLanguage":"swift"},"pathComponents":["Point"],"names":{"title":"Point","navigator":[{"kind":"identifier","spelling":"Point"}],"subHeading":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Point"}]},"declarationFragments":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Point"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":9,"character":14}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo5PointV1xSdvp","interfaceLanguage":"swift"},"pathComponents":["Point","x"],"names":{"title":"x","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":10,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo5PointV1ySdvp","interfaceLanguage":"swift"},"pathComponents":["Point","y"],"names":{"title":"y","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":11,"character":15}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo5PointV1x1yACSd_Sdtcfc","interfaceLanguage":"swift"},"pathComponents":["Point","init(x:y:)"],"names":{"title":"init(x:y:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"x","declarationFragments":[{"kind":"identifier","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},{"name":"y","declarationFragments":[{"kind":"identifier","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":12,"character":11}}},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo6FlavorO","interfaceLanguage":"swift"},"pathComponents":["Flavor"],"names":{"title":"Flavor","navigator":[{"kind":"identifier","spelling":"Flavor"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Flavor"}]},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Flavor"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":15,"character":12}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo6FlavorO","interfaceLanguage":"swift"},"pathComponents":["Flavor","hashValue"],"names":{"title":"hashValue","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hashValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hashValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public"},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo6FlavorO","interfaceLanguage":"swift"},"pathComponents":["Flavor","hash(into:)"],"names":{"title":"hash(into:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hash"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"into"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"into","internalName":"hasher","declarationFragments":[{"kind":"identifier","spelling":"hasher"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"}]}],"returns":[{"kind":"text","spelling":"()"}]},"swiftGenerics":{"constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hash"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"into"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"hasher"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"},{"kind":"text","spelling":")"}],"accessLevel":"public"},{"kind":{"identifier":"swift.func.op","displayName":"Operator"},"identifier":{"precise":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO","interfaceLanguage":"swift"},"pathComponents":["Flavor","!=(_:_:)"],"names":{"title":"!=(_:_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"!="},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":", "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"docComment":{"module":"Swift","lines":[{"text":"Returns a Boolean value indicating whether two values are not equal."},{"text":""},{"text":"Inequality is the inverse of equality. For any values `a` and `b`, `a != b`"},{"text":"implies that `a == b` is `false`."},{"text":""},{"text":"This is the default implementation of the not-equal-to operator (`!=`)"},{"text":"for any type that conforms to `Equatable`."},{"text":""},{"text":"- Parameters:"},{"text":" - lhs: A value to compare."},{"text":" - rhs: Another value to compare."}]},"functionSignature":{"parameters":[{"name":"lhs","declarationFragments":[{"kind":"identifier","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Self"}]},{"name":"rhs","declarationFragments":[{"kind":"identifier","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Self"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"!="},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"internalParam","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":", "},{"kind":"internalParam","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}],"accessLevel":"public"},{"kind":{"identifier":"swift.type.method","displayName":"Type Method"},"identifier":{"precise":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO","interfaceLanguage":"swift"},"pathComponents":["Flavor","makeFromRawAttachmentValue(_:)"],"names":{"title":"makeFromRawAttachmentValue(_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeFromRawAttachmentValue"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"repr","declarationFragments":[{"kind":"identifier","spelling":"repr"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":"?"}]},"swiftGenerics":{"constraints":[{"kind":"conformance","lhs":"Self.RawValue","rhs":"CVAttachmentValueRepresentable","rhsPrecise":"s:9CoreVideo30CVAttachmentValueRepresentableP"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self.RawValue","rhs":"CVAttachmentValueRepresentable","rhsPrecise":"s:9CoreVideo30CVAttachmentValueRepresentableP"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeFromRawAttachmentValue"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"repr"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":"?"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":27,"minor":0}},{"domain":"macOS","introduced":{"major":27,"minor":0}},{"domain":"tvOS","introduced":{"major":27,"minor":0}},{"domain":"visionOS","introduced":{"major":27,"minor":0}},{"domain":"watchOS","introduced":{"major":27,"minor":0}}]},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo6FlavorO","interfaceLanguage":"swift"},"pathComponents":["Flavor","rawAttachmentValueRepresentation"],"names":{"title":"rawAttachmentValueRepresentation","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"rawAttachmentValueRepresentation"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self.RawValue","rhs":"CVAttachmentValueRepresentable","rhsPrecise":"s:9CoreVideo30CVAttachmentValueRepresentableP"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"rawAttachmentValueRepresentation"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":27,"minor":0}},{"domain":"macOS","introduced":{"major":27,"minor":0}},{"domain":"tvOS","introduced":{"major":27,"minor":0}},{"domain":"visionOS","introduced":{"major":27,"minor":0}},{"domain":"watchOS","introduced":{"major":27,"minor":0}}]},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo6FlavorO7vanillayA2CmF","interfaceLanguage":"swift"},"pathComponents":["Flavor","vanilla"],"names":{"title":"Flavor.vanilla","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"vanilla"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"vanilla"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":15,"character":31}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo6FlavorO9chocolateyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Flavor","chocolate"],"names":{"title":"Flavor.chocolate","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"chocolate"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"chocolate"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Demo.swift","position":{"line":15,"character":44}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo6FlavorO8rawValueACSgSi_tcfc","interfaceLanguage":"swift"},"pathComponents":["Flavor","init(rawValue:)"],"names":{"title":"init(rawValue:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"rawValue","declarationFragments":[{"kind":"identifier","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"public"},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo0B0C5greet4name5timesS2S_SitF","interfaceLanguage":"swift"},"pathComponents":["Demo","greet(name:times:)"],"names":{"title":"greet(name:times:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"times"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"times","declarationFragments":[{"kind":"identifier","spelling":"times"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.class"},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"times"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":1,"character":16}}},{"kind":{"identifier":"swift.type.property","displayName":"Type Property"},"identifier":{"precise":"s:9SwiftDemo0B0C7versionSSvpZ","interfaceLanguage":"swift"},"pathComponents":["Demo","version"],"names":{"title":"version","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"version"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.class"},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"version"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":5,"character":22}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo5PointV11descriptionSSvp","interfaceLanguage":"swift"},"pathComponents":["Point","description"],"names":{"title":"description","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"description"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.struct"},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"description"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":9,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo5PointV6lengthSdvp","interfaceLanguage":"swift"},"pathComponents":["Point","length"],"names":{"title":"length","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"length"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.struct"},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"length"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":10,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo6FlavorO11descriptionSSvp","interfaceLanguage":"swift"},"pathComponents":["Flavor","description"],"names":{"title":"description","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"description"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.enum"},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"description"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":14,"character":15}}},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5StyleO","interfaceLanguage":"swift"},"pathComponents":["Polygon","Style"],"names":{"title":"Polygon.Style","navigator":[{"kind":"identifier","spelling":"Style"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Style"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.class"},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Style"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":31,"character":16}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO","interfaceLanguage":"swift"},"pathComponents":["Polygon","Style","hashValue"],"names":{"title":"hashValue","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hashValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hashValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public"},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO","interfaceLanguage":"swift"},"pathComponents":["Polygon","Style","hash(into:)"],"names":{"title":"hash(into:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hash"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"into"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"into","internalName":"hasher","declarationFragments":[{"kind":"identifier","spelling":"hasher"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"}]}],"returns":[{"kind":"text","spelling":"()"}]},"swiftGenerics":{"constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hash"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"into"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"hasher"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"},{"kind":"text","spelling":")"}],"accessLevel":"public"},{"kind":{"identifier":"swift.func.op","displayName":"Operator"},"identifier":{"precise":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO","interfaceLanguage":"swift"},"pathComponents":["Polygon","Style","!=(_:_:)"],"names":{"title":"!=(_:_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"!="},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":", "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"docComment":{"module":"Swift","lines":[{"text":"Returns a Boolean value indicating whether two values are not equal."},{"text":""},{"text":"Inequality is the inverse of equality. For any values `a` and `b`, `a != b`"},{"text":"implies that `a == b` is `false`."},{"text":""},{"text":"This is the default implementation of the not-equal-to operator (`!=`)"},{"text":"for any type that conforms to `Equatable`."},{"text":""},{"text":"- Parameters:"},{"text":" - lhs: A value to compare."},{"text":" - rhs: Another value to compare."}]},"functionSignature":{"parameters":[{"name":"lhs","declarationFragments":[{"kind":"identifier","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Self"}]},{"name":"rhs","declarationFragments":[{"kind":"identifier","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Self"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"!="},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"internalParam","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":", "},{"kind":"internalParam","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}],"accessLevel":"public"},{"kind":{"identifier":"swift.type.method","displayName":"Type Method"},"identifier":{"precise":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO","interfaceLanguage":"swift"},"pathComponents":["Polygon","Style","makeFromRawAttachmentValue(_:)"],"names":{"title":"makeFromRawAttachmentValue(_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeFromRawAttachmentValue"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"repr","declarationFragments":[{"kind":"identifier","spelling":"repr"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":"?"}]},"swiftGenerics":{"constraints":[{"kind":"conformance","lhs":"Self.RawValue","rhs":"CVAttachmentValueRepresentable","rhsPrecise":"s:9CoreVideo30CVAttachmentValueRepresentableP"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self.RawValue","rhs":"CVAttachmentValueRepresentable","rhsPrecise":"s:9CoreVideo30CVAttachmentValueRepresentableP"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeFromRawAttachmentValue"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"repr"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":"?"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":27,"minor":0}},{"domain":"macOS","introduced":{"major":27,"minor":0}},{"domain":"tvOS","introduced":{"major":27,"minor":0}},{"domain":"visionOS","introduced":{"major":27,"minor":0}},{"domain":"watchOS","introduced":{"major":27,"minor":0}}]},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO","interfaceLanguage":"swift"},"pathComponents":["Polygon","Style","rawAttachmentValueRepresentation"],"names":{"title":"rawAttachmentValueRepresentation","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"rawAttachmentValueRepresentation"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self.RawValue","rhs":"CVAttachmentValueRepresentable","rhsPrecise":"s:9CoreVideo30CVAttachmentValueRepresentableP"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"rawAttachmentValueRepresentation"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":27,"minor":0}},{"domain":"macOS","introduced":{"major":27,"minor":0}},{"domain":"tvOS","introduced":{"major":27,"minor":0}},{"domain":"visionOS","introduced":{"major":27,"minor":0}},{"domain":"watchOS","introduced":{"major":27,"minor":0}}]},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5StyleO5solidyA2EmF","interfaceLanguage":"swift"},"pathComponents":["Polygon","Style","solid"],"names":{"title":"Polygon.Style.solid","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"solid"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"solid"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":31,"character":37}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5StyleO6dashedyA2EmF","interfaceLanguage":"swift"},"pathComponents":["Polygon","Style","dashed"],"names":{"title":"Polygon.Style.dashed","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"dashed"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"dashed"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":31,"character":44}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5StyleO8rawValueAESgSS_tcfc","interfaceLanguage":"swift"},"pathComponents":["Polygon","Style","init(rawValue:)"],"names":{"title":"init(rawValue:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"rawValue","declarationFragments":[{"kind":"identifier","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}],"accessLevel":"public"},{"kind":{"identifier":"swift.struct","displayName":"Structure"},"identifier":{"precise":"s:9SwiftDemo7PolygonC7MetricsV","interfaceLanguage":"swift"},"pathComponents":["Polygon","Metrics"],"names":{"title":"Polygon.Metrics","navigator":[{"kind":"identifier","spelling":"Metrics"}],"subHeading":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Metrics"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.class"},"declarationFragments":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Metrics"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":33,"character":18}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7PolygonC7MetricsV9perimeterSdvp","interfaceLanguage":"swift"},"pathComponents":["Polygon","Metrics","perimeter"],"names":{"title":"perimeter","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"perimeter"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"perimeter"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":34,"character":19}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7PolygonC7MetricsV9perimeterAESd_tcfc","interfaceLanguage":"swift"},"pathComponents":["Polygon","Metrics","init(perimeter:)"],"names":{"title":"init(perimeter:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"perimeter"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"perimeter","declarationFragments":[{"kind":"identifier","spelling":"perimeter"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"perimeter"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":35,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5styleAC5StyleOvp","interfaceLanguage":"swift"},"pathComponents":["Polygon","style"],"names":{"title":"style","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"style"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Style","preciseIdentifier":"s:9SwiftDemo7PolygonC5StyleO"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.class"},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"style"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Style","preciseIdentifier":"s:9SwiftDemo7PolygonC5StyleO"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":38,"character":15}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC7metrics4sideAC7MetricsVSd_tF","interfaceLanguage":"swift"},"pathComponents":["Polygon","metrics(side:)"],"names":{"title":"metrics(side:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"metrics"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Metrics","preciseIdentifier":"s:9SwiftDemo7PolygonC7MetricsV"}]},"functionSignature":{"parameters":[{"name":"side","declarationFragments":[{"kind":"identifier","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"},{"kind":"text","spelling":"."},{"kind":"typeIdentifier","spelling":"Metrics","preciseIdentifier":"s:9SwiftDemo7PolygonC7MetricsV"}]},"swiftExtension":{"extendedModule":"SwiftDemo","typeKind":"swift.class"},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"metrics"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Metrics","preciseIdentifier":"s:9SwiftDemo7PolygonC7MetricsV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Extensions.swift","position":{"line":39,"character":16}}},{"kind":{"identifier":"swift.protocol","displayName":"Protocol"},"identifier":{"precise":"s:9SwiftDemo5ShapeP","interfaceLanguage":"swift"},"pathComponents":["Shape"],"names":{"title":"Shape","navigator":[{"kind":"identifier","spelling":"Shape"}],"subHeading":[{"kind":"keyword","spelling":"protocol"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Shape"}]},"declarationFragments":[{"kind":"keyword","spelling":"protocol"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Shape"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Greeter","preciseIdentifier":"s:9SwiftDemo7GreeterP"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":2,"character":16}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo5ShapeP4areaSdvp","interfaceLanguage":"swift"},"pathComponents":["Shape","area"],"names":{"title":"area","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":3,"character":8}}},{"kind":{"identifier":"swift.type.property","displayName":"Type Property"},"identifier":{"precise":"s:9SwiftDemo5ShapeP5sidesSivpZ","interfaceLanguage":"swift"},"pathComponents":["Shape","sides"],"names":{"title":"sides","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"sides"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"sides"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":4,"character":15}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo7PolygonC","interfaceLanguage":"swift"},"pathComponents":["Polygon"],"names":{"title":"Polygon","navigator":[{"kind":"identifier","spelling":"Polygon"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Polygon"}]},"declarationFragments":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Polygon"}],"accessLevel":"open","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":7,"character":11}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7PolygonC4nameSSvp","interfaceLanguage":"swift"},"pathComponents":["Polygon","name"],"names":{"title":"name","subHeading":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":8,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7PolygonC11vertexCountSivp","interfaceLanguage":"swift"},"pathComponents":["Polygon","vertexCount"],"names":{"title":"vertexCount","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"vertexCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"vertexCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { get }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":9,"character":28}}},{"kind":{"identifier":"swift.type.property","displayName":"Type Property"},"identifier":{"precise":"s:9SwiftDemo7PolygonC6sharedACvpZ","interfaceLanguage":"swift"},"pathComponents":["Polygon","shared"],"names":{"title":"shared","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"shared"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"shared"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":10,"character":22}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7PolygonC4name11vertexCountACSS_Sitcfc","interfaceLanguage":"swift"},"pathComponents":["Polygon","init(name:vertexCount:)"],"names":{"title":"init(name:vertexCount:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"vertexCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"vertexCount","declarationFragments":[{"kind":"identifier","spelling":"vertexCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"vertexCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":12,"character":11}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7PolygonC4nameACSgSS_tcfc","interfaceLanguage":"swift"},"pathComponents":["Polygon","init(name:)"],"names":{"title":"init(name:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"convenience"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":17,"character":23}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5scale2byySd_tF","interfaceLanguage":"swift"},"pathComponents":["Polygon","scale(by:)"],"names":{"title":"scale(by:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"by","internalName":"factor","declarationFragments":[{"kind":"identifier","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"open","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":22,"character":14}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5scale2byySi_tF","interfaceLanguage":"swift"},"pathComponents":["Polygon","scale(by:)"],"names":{"title":"scale(by:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"by","internalName":"factor","declarationFragments":[{"kind":"identifier","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"open","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":23,"character":14}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC5scale1x1yySd_SdtF","interfaceLanguage":"swift"},"pathComponents":["Polygon","scale(x:y:)"],"names":{"title":"scale(x:y:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"x","declarationFragments":[{"kind":"identifier","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},{"name":"y","declarationFragments":[{"kind":"identifier","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"x"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"y"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":24,"character":16}}},{"kind":{"identifier":"swift.type.method","displayName":"Type Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC4makeACyFZ","interfaceLanguage":"swift"},"pathComponents":["Polygon","make()"],"names":{"title":"make()","subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"make"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"}]},"declarationFragments":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"make"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":26,"character":22}}},{"kind":{"identifier":"swift.type.method","displayName":"Type Method"},"identifier":{"precise":"s:9SwiftDemo7PolygonC8describeySSACSgFZ","interfaceLanguage":"swift"},"pathComponents":["Polygon","describe(_:)"],"names":{"title":"describe(_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"describe"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"polygon","declarationFragments":[{"kind":"identifier","spelling":"polygon"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"},{"kind":"text","spelling":"?"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"describe"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"polygon"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Polygon","preciseIdentifier":"s:9SwiftDemo7PolygonC"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":27,"character":23}}},{"kind":{"identifier":"swift.subscript","displayName":"Instance Subscript"},"identifier":{"precise":"s:9SwiftDemo7PolygonCyAA5PointVSicip","interfaceLanguage":"swift"},"pathComponents":["Polygon","subscript(_:)"],"names":{"title":"subscript(_:)","subHeading":[{"kind":"keyword","spelling":"subscript"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"functionSignature":{"parameters":[{"name":"index","declarationFragments":[{"kind":"identifier","spelling":"index"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"declarationFragments":[{"kind":"keyword","spelling":"subscript"},{"kind":"text","spelling":"("},{"kind":"internalParam","spelling":"index"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":29,"character":11}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo6SquareC","interfaceLanguage":"swift"},"pathComponents":["Square"],"names":{"title":"Square","navigator":[{"kind":"identifier","spelling":"Square"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Square"}]},"declarationFragments":[{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Square"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":34,"character":19}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo6SquareC4sideSdvp","interfaceLanguage":"swift"},"pathComponents":["Square","side"],"names":{"title":"side","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":35,"character":15}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo6SquareC4sideACSd_tcfc","interfaceLanguage":"swift"},"pathComponents":["Square","init(side:)"],"names":{"title":"init(side:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"side","declarationFragments":[{"kind":"identifier","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":37,"character":11}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo6SquareC4areaSdvp","interfaceLanguage":"swift"},"pathComponents":["Square","area"],"names":{"title":"area","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":42,"character":15}}},{"kind":{"identifier":"swift.type.property","displayName":"Type Property"},"identifier":{"precise":"s:9SwiftDemo6SquareC5sidesSivpZ","interfaceLanguage":"swift"},"pathComponents":["Square","sides"],"names":{"title":"sides","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"sides"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"sides"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":43,"character":22}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6SquareC5greet4nameS2S_tF","interfaceLanguage":"swift"},"pathComponents":["Square","greet(name:)"],"names":{"title":"greet(name:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greet"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":44,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6SquareC5scale2byySd_tF","interfaceLanguage":"swift"},"pathComponents":["Square","scale(by:)"],"names":{"title":"scale(by:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"by","internalName":"factor","declarationFragments":[{"kind":"identifier","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"override"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"scale"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"factor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":46,"character":25}}},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo13PrecipitationO","interfaceLanguage":"swift"},"pathComponents":["Precipitation"],"names":{"title":"Precipitation","navigator":[{"kind":"identifier","spelling":"Precipitation"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Precipitation"}]},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Precipitation"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":50,"character":12}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","interfaceLanguage":"swift"},"pathComponents":["Precipitation","hashValue"],"names":{"title":"hashValue","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hashValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hashValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public"},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","interfaceLanguage":"swift"},"pathComponents":["Precipitation","hash(into:)"],"names":{"title":"hash(into:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hash"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"into"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"into","internalName":"hasher","declarationFragments":[{"kind":"identifier","spelling":"hasher"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"}]}],"returns":[{"kind":"text","spelling":"()"}]},"swiftGenerics":{"constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self","rhs":"Hashable","rhsPrecise":"s:SH"},{"kind":"conformance","lhs":"Self.RawValue","rhs":"Hashable","rhsPrecise":"s:SH"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"hash"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"into"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"hasher"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Hasher","preciseIdentifier":"s:s6HasherV"},{"kind":"text","spelling":")"}],"accessLevel":"public"},{"kind":{"identifier":"swift.func.op","displayName":"Operator"},"identifier":{"precise":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","interfaceLanguage":"swift"},"pathComponents":["Precipitation","!=(_:_:)"],"names":{"title":"!=(_:_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"!="},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":", "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"docComment":{"module":"Swift","lines":[{"text":"Returns a Boolean value indicating whether two values are not equal."},{"text":""},{"text":"Inequality is the inverse of equality. For any values `a` and `b`, `a != b`"},{"text":"implies that `a == b` is `false`."},{"text":""},{"text":"This is the default implementation of the not-equal-to operator (`!=`)"},{"text":"for any type that conforms to `Equatable`."},{"text":""},{"text":"- Parameters:"},{"text":" - lhs: A value to compare."},{"text":" - rhs: Another value to compare."}]},"functionSignature":{"parameters":[{"name":"lhs","declarationFragments":[{"kind":"identifier","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Self"}]},{"name":"rhs","declarationFragments":[{"kind":"identifier","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Self"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"!="},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"internalParam","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":", "},{"kind":"internalParam","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"borrowing"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}],"accessLevel":"public"},{"kind":{"identifier":"swift.type.method","displayName":"Type Method"},"identifier":{"precise":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","interfaceLanguage":"swift"},"pathComponents":["Precipitation","makeFromRawAttachmentValue(_:)"],"names":{"title":"makeFromRawAttachmentValue(_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeFromRawAttachmentValue"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"repr","declarationFragments":[{"kind":"identifier","spelling":"repr"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":"?"}]},"swiftGenerics":{"constraints":[{"kind":"conformance","lhs":"Self.RawValue","rhs":"CVAttachmentValueRepresentable","rhsPrecise":"s:9CoreVideo30CVAttachmentValueRepresentableP"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self.RawValue","rhs":"CVAttachmentValueRepresentable","rhsPrecise":"s:9CoreVideo30CVAttachmentValueRepresentableP"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeFromRawAttachmentValue"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"repr"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":"?"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":27,"minor":0}},{"domain":"macOS","introduced":{"major":27,"minor":0}},{"domain":"tvOS","introduced":{"major":27,"minor":0}},{"domain":"visionOS","introduced":{"major":27,"minor":0}},{"domain":"watchOS","introduced":{"major":27,"minor":0}}]},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","interfaceLanguage":"swift"},"pathComponents":["Precipitation","rawAttachmentValueRepresentation"],"names":{"title":"rawAttachmentValueRepresentation","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"rawAttachmentValueRepresentation"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol","constraints":[{"kind":"conformance","lhs":"Self.RawValue","rhs":"CVAttachmentValueRepresentable","rhsPrecise":"s:9CoreVideo30CVAttachmentValueRepresentableP"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"rawAttachmentValueRepresentation"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"CVAttachmentRawValue","preciseIdentifier":"s:9CoreVideo20CVAttachmentRawValueV"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":27,"minor":0}},{"domain":"macOS","introduced":{"major":27,"minor":0}},{"domain":"tvOS","introduced":{"major":27,"minor":0}},{"domain":"visionOS","introduced":{"major":27,"minor":0}},{"domain":"watchOS","introduced":{"major":27,"minor":0}}]},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo13PrecipitationO4rainyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Precipitation","rain"],"names":{"title":"Precipitation.rain","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"rain"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"rain"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":51,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo13PrecipitationO4snowyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Precipitation","snow"],"names":{"title":"Precipitation.snow","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"snow"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"snow"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":51,"character":15}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo13PrecipitationO4noneyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Precipitation","none"],"names":{"title":"Precipitation.none","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"none"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"none"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":51,"character":21}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo13PrecipitationO8rawValueACSgSS_tcfc","interfaceLanguage":"swift"},"pathComponents":["Precipitation","init(rawValue:)"],"names":{"title":"init(rawValue:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"rawValue","declarationFragments":[{"kind":"identifier","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"?("},{"kind":"externalParam","spelling":"rawValue"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}],"accessLevel":"public"},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo10ShapeErrorO","interfaceLanguage":"swift"},"pathComponents":["ShapeError"],"names":{"title":"ShapeError","navigator":[{"kind":"identifier","spelling":"ShapeError"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"ShapeError"}]},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"ShapeError"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":54,"character":12}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:s5ErrorP10FoundationE20localizedDescriptionSSvp::SYNTHESIZED::s:9SwiftDemo10ShapeErrorO","interfaceLanguage":"swift"},"pathComponents":["ShapeError","localizedDescription"],"names":{"title":"localizedDescription","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"localizedDescription"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"docComment":{"module":"Foundation","lines":[{"text":"Retrieve the localized description for this error."}]},"swiftExtension":{"extendedModule":"Swift","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"localizedDescription"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":8,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":10}},{"domain":"tvOS","introduced":{"major":9,"minor":0}},{"domain":"watchOS","introduced":{"major":2,"minor":0}}]},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo10ShapeErrorO11invalidSideyACSdcACmF","interfaceLanguage":"swift"},"pathComponents":["ShapeError","invalidSide(_:)"],"names":{"title":"ShapeError.invalidSide(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"invalidSide"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"invalidSide"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":55,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo10ShapeErrorO12tooManySidesyACSi_SitcACmF","interfaceLanguage":"swift"},"pathComponents":["ShapeError","tooManySides(count:limit:)"],"names":{"title":"ShapeError.tooManySides(count:limit:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"tooManySides"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"limit"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"tooManySides"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"limit"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":56,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo10ShapeErrorO7unknownyA2CmF","interfaceLanguage":"swift"},"pathComponents":["ShapeError","unknown"],"names":{"title":"ShapeError.unknown","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"unknown"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"unknown"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":57,"character":9}}},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO","interfaceLanguage":"swift"},"pathComponents":["Measurement"],"names":{"title":"Measurement","navigator":[{"kind":"identifier","spelling":"Measurement"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Measurement"}]},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Measurement"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":60,"character":12}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO6lengthyACSdcACmF","interfaceLanguage":"swift"},"pathComponents":["Measurement","length(_:)"],"names":{"title":"Measurement.length(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"length"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"length"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":61,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO4areayACSd_SdtcACmF","interfaceLanguage":"swift"},"pathComponents":["Measurement","area(width:height:)"],"names":{"title":"Measurement.area(width:height:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"width"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"height"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"width"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"height"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":62,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO4noneyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Measurement","none"],"names":{"title":"Measurement.none","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"none"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"none"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":63,"character":9}}},{"kind":{"identifier":"swift.struct","displayName":"Structure"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO4UnitV","interfaceLanguage":"swift"},"pathComponents":["Measurement","Unit"],"names":{"title":"Measurement.Unit","navigator":[{"kind":"identifier","spelling":"Unit"}],"subHeading":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Unit"}]},"declarationFragments":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Unit"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":65,"character":18}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO4UnitV6symbolSSvp","interfaceLanguage":"swift"},"pathComponents":["Measurement","Unit","symbol"],"names":{"title":"symbol","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"symbol"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"symbol"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":66,"character":19}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO4UnitV6symbolAESS_tcfc","interfaceLanguage":"swift"},"pathComponents":["Measurement","Unit","init(symbol:)"],"names":{"title":"init(symbol:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"symbol"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"symbol","declarationFragments":[{"kind":"identifier","spelling":"symbol"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"symbol"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":67,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo11MeasurementO6isNoneSbvp","interfaceLanguage":"swift"},"pathComponents":["Measurement","isNone"],"names":{"title":"isNone","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"isNone"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"isNone"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":70,"character":15}}},{"kind":{"identifier":"swift.struct","displayName":"Structure"},"identifier":{"precise":"s:9SwiftDemo4RingV","interfaceLanguage":"swift"},"pathComponents":["Ring"],"names":{"title":"Ring","navigator":[{"kind":"identifier","spelling":"Ring"}],"subHeading":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Ring"}]},"declarationFragments":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Ring"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":76,"character":14}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo4RingV5innerAA5PointVvp","interfaceLanguage":"swift"},"pathComponents":["Ring","inner"],"names":{"title":"inner","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"inner"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"inner"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":77,"character":15}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo4RingV5outerAA5PointVvp","interfaceLanguage":"swift"},"pathComponents":["Ring","outer"],"names":{"title":"outer","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"outer"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"outer"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":78,"character":15}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo4RingV5inner5outerAcA5PointV_AGtcfc","interfaceLanguage":"swift"},"pathComponents":["Ring","init(inner:outer:)"],"names":{"title":"init(inner:outer:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"inner"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"outer"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"inner","declarationFragments":[{"kind":"identifier","spelling":"inner"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},{"name":"outer","declarationFragments":[{"kind":"identifier","spelling":"outer"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"inner"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"outer"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":80,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo4RingV6expand2byySd_tF","interfaceLanguage":"swift"},"pathComponents":["Ring","expand(by:)"],"names":{"title":"expand(by:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"expand"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"by","internalName":"delta","declarationFragments":[{"kind":"identifier","spelling":"delta"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"mutating"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"expand"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"delta"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":85,"character":25}}},{"kind":{"identifier":"swift.func.op","displayName":"Operator"},"identifier":{"precise":"s:9SwiftDemo4RingV1poiyA2C_ACtFZ","interfaceLanguage":"swift"},"pathComponents":["Ring","+(_:_:)"],"names":{"title":"+(_:_:)","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"+"},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"}]},"functionSignature":{"parameters":[{"name":"lhs","declarationFragments":[{"kind":"identifier","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"}]},{"name":"rhs","declarationFragments":[{"kind":"identifier","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"+"},{"kind":"text","spelling":" "},{"kind":"text","spelling":"("},{"kind":"internalParam","spelling":"lhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"},{"kind":"text","spelling":", "},{"kind":"internalParam","spelling":"rhs"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Ring","preciseIdentifier":"s:9SwiftDemo4RingV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":90,"character":23}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter"],"names":{"title":"Counter","navigator":[{"kind":"identifier","spelling":"Counter"}],"subHeading":[{"kind":"keyword","spelling":"actor"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Counter"}]},"declarationFragments":[{"kind":"keyword","spelling":"actor"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Counter"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":95,"character":13}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pqd_0_YKXEqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter","withSerialExecutor(_:)"],"names":{"title":"withSerialExecutor(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withSerialExecutor"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"genericParameter","spelling":"E"},{"kind":"text","spelling":">((any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"}]},"docComment":{"module":"_Concurrency","lines":[{"text":"Perform an operation with the actor's ``SerialExecutor``."},{"text":""},{"text":"This converts the actor's ``Actor/unownedExecutor`` to a ``SerialExecutor`` while"},{"text":"retaining the actor for the duration of the operation. This is to ensure the lifetime"},{"text":"of the executor while performing the operation."}]},"functionSignature":{"parameters":[{"name":"operation","declarationFragments":[{"kind":"identifier","spelling":"operation"},{"kind":"text","spelling":": (any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"}]}],"returns":[{"kind":"typeIdentifier","spelling":"T"}]},"swiftGenerics":{"parameters":[{"name":"T","index":0,"depth":1},{"name":"E","index":1,"depth":1}],"constraints":[{"kind":"conformance","lhs":"E","rhs":"Error","rhsPrecise":"s:s5ErrorP"}]},"swiftExtension":{"extendedModule":"_Concurrency","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withSerialExecutor"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"genericParameter","spelling":"E"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"operation"},{"kind":"text","spelling":": (any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"where"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Error","preciseIdentifier":"s:s5ErrorP"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" : ~Copyable"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":13,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":15}},{"domain":"tvOS","introduced":{"major":13,"minor":0}},{"domain":"watchOS","introduced":{"major":6,"minor":0}}]},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pYaqd_0_YKYCXEYaqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter","withSerialExecutor(_:)"],"names":{"title":"withSerialExecutor(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withSerialExecutor"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"genericParameter","spelling":"E"},{"kind":"text","spelling":">("},{"kind":"keyword","spelling":"nonisolated(nonsending)"},{"kind":"text","spelling":" (any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"}]},"docComment":{"module":"_Concurrency","lines":[{"text":"Perform an operation with the actor's ``SerialExecutor``."},{"text":""},{"text":"This converts the actor's ``Actor/unownedExecutor`` to a ``SerialExecutor`` while"},{"text":"retaining the actor for the duration of the operation. This is to ensure the lifetime"},{"text":"of the executor while performing the operation."}]},"functionSignature":{"parameters":[{"name":"operation","declarationFragments":[{"kind":"identifier","spelling":"operation"},{"kind":"text","spelling":": (any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"}]}],"returns":[{"kind":"typeIdentifier","spelling":"T"}]},"swiftGenerics":{"parameters":[{"name":"T","index":0,"depth":1},{"name":"E","index":1,"depth":1}],"constraints":[{"kind":"conformance","lhs":"E","rhs":"Error","rhsPrecise":"s:s5ErrorP"}]},"swiftExtension":{"extendedModule":"_Concurrency","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withSerialExecutor"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"genericParameter","spelling":"E"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"operation"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"nonisolated(nonsending)"},{"kind":"text","spelling":" (any "},{"kind":"typeIdentifier","spelling":"SerialExecutor","preciseIdentifier":"s:Scf"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"where"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"E"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Error","preciseIdentifier":"s:s5ErrorP"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" : ~Copyable"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":13,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":15}},{"domain":"tvOS","introduced":{"major":13,"minor":0}},{"domain":"watchOS","introduced":{"major":6,"minor":0}}]},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:ScA12_ConcurrencyE20preconditionIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter","preconditionIsolated(_:file:line:)"],"names":{"title":"preconditionIsolated(_:file:line:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"preconditionIsolated"},{"kind":"text","spelling":"("},{"kind":"attribute","spelling":"@autoclosure "},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":")"}]},"docComment":{"module":"_Concurrency","lines":[{"text":"Stops program execution if the current task is not executing on this"},{"text":"actor's serial executor."},{"text":""},{"text":"This function's effect varies depending on the build flag used:"},{"text":""},{"text":"* In playgrounds and `-Onone` builds (the default for Xcode's Debug"},{"text":" configuration), stops program execution in a debuggable state after"},{"text":" printing `message`."},{"text":""},{"text":"* In `-O` builds (the default for Xcode's Release configuration), stops"},{"text":" program execution."},{"text":""},{"text":"- Note: Because this check is performed against the actor's serial executor,"},{"text":" if another actor uses the same serial executor--by using"},{"text":" that actor's serial executor as its own ``Actor/unownedExecutor``--this"},{"text":" check will succeed. From a concurrency safety perspective, the"},{"text":" serial executor guarantees mutual exclusion of those two actors."},{"text":""},{"text":"- Parameters:"},{"text":" - message: The message to print if the assertion fails."},{"text":" - file: The file name to print if the assertion fails. The default is"},{"text":" where this method was called."},{"text":" - line: The line number to print if the assertion fails The default is"},{"text":" where this method was called."}]},"functionSignature":{"parameters":[{"name":"message","declarationFragments":[{"kind":"identifier","spelling":"message"},{"kind":"text","spelling":": () -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"file","declarationFragments":[{"kind":"identifier","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"}]},{"name":"line","declarationFragments":[{"kind":"identifier","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"}]}],"returns":[{"kind":"text","spelling":"()"}]},"swiftExtension":{"extendedModule":"_Concurrency","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"text","spelling":"@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)\n"},{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"preconditionIsolated"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"message"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@autoclosure "},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" = String(), "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#fileID"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#line"},{"kind":"text","spelling":")"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":13,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":15}},{"domain":"tvOS","introduced":{"major":13,"minor":0}},{"domain":"watchOS","introduced":{"major":6,"minor":0}}]},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:ScA12_ConcurrencyE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter","assertIsolated(_:file:line:)"],"names":{"title":"assertIsolated(_:file:line:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"assertIsolated"},{"kind":"text","spelling":"("},{"kind":"attribute","spelling":"@autoclosure "},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":")"}]},"docComment":{"module":"_Concurrency","lines":[{"text":"Stops program execution if the current task is not executing on this"},{"text":"actor's serial executor."},{"text":""},{"text":"This function's effect varies depending on the build flag used:"},{"text":""},{"text":"* In playgrounds and `-Onone` builds (the default for Xcode's Debug"},{"text":" configuration), stops program execution in a debuggable state after"},{"text":" printing `message`."},{"text":""},{"text":"* In `-O` builds (the default for Xcode's Release configuration),"},{"text":" the isolation check is not performed and there are no effects."},{"text":""},{"text":"- Note: This check is performed against the actor's serial executor,"},{"text":" meaning that / if another actor uses the same serial executor--by using"},{"text":" that actor's serial executor as its own ``Actor/unownedExecutor``--this"},{"text":" check will succeed , as from a concurrency safety perspective, the"},{"text":" serial executor guarantees mutual exclusion of those two actors."},{"text":""},{"text":"- Parameters:"},{"text":" - message: The message to print if the assertion fails."},{"text":" - file: The file name to print if the assertion fails. The default is"},{"text":" where this method was called."},{"text":" - line: The line number to print if the assertion fails The default is"},{"text":" where this method was called."}]},"functionSignature":{"parameters":[{"name":"message","declarationFragments":[{"kind":"identifier","spelling":"message"},{"kind":"text","spelling":": () -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"file","declarationFragments":[{"kind":"identifier","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"}]},{"name":"line","declarationFragments":[{"kind":"identifier","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"}]}],"returns":[{"kind":"text","spelling":"()"}]},"swiftExtension":{"extendedModule":"_Concurrency","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"text","spelling":"@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)\n"},{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"assertIsolated"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"message"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@autoclosure "},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" = String(), "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#fileID"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#line"},{"kind":"text","spelling":")"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":13,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":15}},{"domain":"tvOS","introduced":{"major":13,"minor":0}},{"domain":"watchOS","introduced":{"major":6,"minor":0}}]},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:ScA12_ConcurrencyE14assumeIsolated_4file4lineqd__qd__xYiKXE_s12StaticStringVSutKs8SendableRd__lF::SYNTHESIZED::s:9SwiftDemo7CounterC","interfaceLanguage":"swift"},"pathComponents":["Counter","assumeIsolated(_:file:line:)"],"names":{"title":"assumeIsolated(_:file:line:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"assumeIsolated"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":">(("},{"kind":"keyword","spelling":"isolated"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"rethrows"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"T"}]},"docComment":{"module":"_Concurrency","lines":[{"text":"Assume that the current task is executing on this actor's serial executor,"},{"text":"or stop program execution otherwise."},{"text":""},{"text":"You call this method to *assume and verify* that the currently"},{"text":"executing synchronous function is actually executing on the serial"},{"text":"executor of this actor."},{"text":""},{"text":"If that is the case, the operation is invoked with an `isolated` version"},{"text":"of the actor, allowing synchronous access to actor local state without"},{"text":"hopping through asynchronous boundaries."},{"text":""},{"text":"If the current context is not running on the actor's serial executor, or"},{"text":"if the actor is a reference to a remote actor, this method will crash"},{"text":"with a fatal error (similar to ``preconditionIsolated(_:file:line:)``)."},{"text":""},{"text":"Note that this check is performed against the passed in actor's serial"},{"text":"executor, meaning that if another actor uses the same serial executor--by"},{"text":"using that actor's ``Actor/unownedExecutor`` as its own"},{"text":"``Actor/unownedExecutor``--this check will succeed, as from a concurrency"},{"text":"safety perspective, the serial executor guarantees mutual exclusion of"},{"text":"those two actors."},{"text":""},{"text":"This method can only be used from synchronous functions, as asynchronous"},{"text":"functions should instead perform a normal method call to the actor, which"},{"text":"will hop task execution to the target actor if necessary."},{"text":""},{"text":"- Note: This check is performed against the actor's serial executor,"},{"text":" meaning that / if another actor uses the same serial executor--by using"},{"text":" another actor's executor as its own ``Actor/unownedExecutor``"},{"text":" --this check will succeed , as from a concurrency safety perspective,"},{"text":" the serial executor guarantees mutual exclusion of those two actors."},{"text":""},{"text":"- Parameters:"},{"text":" - operation: the operation that will be executed if the current context"},{"text":" is executing on the actors serial executor."},{"text":" - file: The file name to print if the assertion fails. The default is"},{"text":" where this method was called."},{"text":" - line: The line number to print if the assertion fails The default is"},{"text":" where this method was called."},{"text":"- Returns: the return value of the `operation`"},{"text":"- Throws: rethrows the `Error` thrown by the operation if it threw"}]},"functionSignature":{"parameters":[{"name":"operation","declarationFragments":[{"kind":"identifier","spelling":"operation"},{"kind":"text","spelling":": ("},{"kind":"keyword","spelling":"isolated"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"T"}]},{"name":"file","declarationFragments":[{"kind":"identifier","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"}]},{"name":"line","declarationFragments":[{"kind":"identifier","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"}]}],"returns":[{"kind":"typeIdentifier","spelling":"T"}]},"swiftGenerics":{"parameters":[{"name":"T","index":0,"depth":1}],"constraints":[{"kind":"conformance","lhs":"T","rhs":"Sendable","rhsPrecise":"s:s8SendableP"}]},"swiftExtension":{"extendedModule":"_Concurrency","typeKind":"swift.protocol"},"declarationFragments":[{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"assumeIsolated"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"operation"},{"kind":"text","spelling":": ("},{"kind":"keyword","spelling":"isolated"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Self"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"file"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"StaticString","preciseIdentifier":"s:s12StaticStringV"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#fileID"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"line"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt","preciseIdentifier":"s:Su"},{"kind":"text","spelling":" = "},{"kind":"keyword","spelling":"#line"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"rethrows"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"where"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Sendable","preciseIdentifier":"s:s8SendableP"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":13,"minor":0}},{"domain":"macOS","introduced":{"major":10,"minor":15}},{"domain":"tvOS","introduced":{"major":13,"minor":0}},{"domain":"watchOS","introduced":{"major":6,"minor":0}}]},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7CounterC5valueSivp","interfaceLanguage":"swift"},"pathComponents":["Counter","value"],"names":{"title":"value","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { get }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":96,"character":28}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7CounterC4stepSivp","interfaceLanguage":"swift"},"pathComponents":["Counter","step"],"names":{"title":"step","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"step"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"step"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":97,"character":15}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7CounterCACycfc","interfaceLanguage":"swift"},"pathComponents":["Counter","init()"],"names":{"title":"init()","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}]},"functionSignature":{},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":98,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7CounterC9incrementSiyF","interfaceLanguage":"swift"},"pathComponents":["Counter","increment()"],"names":{"title":"increment()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"increment"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"increment"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":99,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7CounterC5labelSSyF","interfaceLanguage":"swift"},"pathComponents":["Counter","label()"],"names":{"title":"label()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"label"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"attribute","spelling":"nonisolated"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"label"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":103,"character":28}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo6CanvasC","interfaceLanguage":"swift"},"pathComponents":["Canvas"],"names":{"title":"Canvas","navigator":[{"kind":"identifier","spelling":"Canvas"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Canvas"}]},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Canvas"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":107,"character":19}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo6CanvasCACycfc","interfaceLanguage":"swift"},"pathComponents":["Canvas","init()"],"names":{"title":"init()","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}]},"functionSignature":{},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":108,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6CanvasC4drawyyAA5Shape_pF","interfaceLanguage":"swift"},"pathComponents":["Canvas","draw(_:)"],"names":{"title":"draw(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"draw"},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"any"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Shape","preciseIdentifier":"s:9SwiftDemo5ShapeP"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"shape","declarationFragments":[{"kind":"identifier","spelling":"shape"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"any"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Shape","preciseIdentifier":"s:9SwiftDemo5ShapeP"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"draw"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"shape"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"any"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Shape","preciseIdentifier":"s:9SwiftDemo5ShapeP"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":109,"character":16}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo6LoaderC","interfaceLanguage":"swift"},"pathComponents":["Loader"],"names":{"title":"Loader","navigator":[{"kind":"identifier","spelling":"Loader"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Loader"}]},"declarationFragments":[{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Loader"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":112,"character":19}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo6LoaderCACycfc","interfaceLanguage":"swift"},"pathComponents":["Loader","init()"],"names":{"title":"init()","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}]},"functionSignature":{},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":113,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC4load4path10Foundation4DataVSS_tKF","interfaceLanguage":"swift"},"pathComponents":["Loader","load(path:)"],"names":{"title":"load(path:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"load"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"path"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"}]},"functionSignature":{"parameters":[{"name":"path","declarationFragments":[{"kind":"identifier","spelling":"path"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"load"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"path"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":115,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC5fetch3urlSS10Foundation3URLV_tYaKF","interfaceLanguage":"swift"},"pathComponents":["Loader","fetch(url:)"],"names":{"title":"fetch(url:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"fetch"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"url"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"url","declarationFragments":[{"kind":"identifier","spelling":"url"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"fetch"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"url"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":116,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC4wait7secondsySd_tYaF","interfaceLanguage":"swift"},"pathComponents":["Loader","wait(seconds:)"],"names":{"title":"wait(seconds:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"wait"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"seconds"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"}]},"functionSignature":{"parameters":[{"name":"seconds","declarationFragments":[{"kind":"identifier","spelling":"seconds"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"wait"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"seconds"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":117,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF","interfaceLanguage":"swift"},"pathComponents":["Loader","transform(_:)"],"names":{"title":"transform(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"transform"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":">("},{"kind":"typeIdentifier","spelling":"T","preciseIdentifier":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF1TL_xmfp"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T","preciseIdentifier":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF1TL_xmfp"}]},"functionSignature":{"parameters":[{"name":"shape","declarationFragments":[{"kind":"identifier","spelling":"shape"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"T","preciseIdentifier":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF1TL_xmfp"}]}],"returns":[{"kind":"typeIdentifier","spelling":"T"}]},"swiftGenerics":{"parameters":[{"name":"T","index":0,"depth":0}],"constraints":[{"kind":"conformance","lhs":"T","rhs":"Shape","rhsPrecise":"s:9SwiftDemo5ShapeP"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"transform"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"T"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"shape"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"T","preciseIdentifier":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF1TL_xmfp"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"T","preciseIdentifier":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF1TL_xmfp"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"where"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"T"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Shape","preciseIdentifier":"s:9SwiftDemo5ShapeP"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":119,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF","interfaceLanguage":"swift"},"pathComponents":["Loader","first(of:)"],"names":{"title":"first(of:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"first"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"Element"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Element","preciseIdentifier":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF7ElementL_xmfp"},{"kind":"text","spelling":"]) -> "},{"kind":"typeIdentifier","spelling":"Element","preciseIdentifier":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF7ElementL_xmfp"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"of","internalName":"items","declarationFragments":[{"kind":"identifier","spelling":"items"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Element","preciseIdentifier":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF7ElementL_xmfp"},{"kind":"text","spelling":"]"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Element"},{"kind":"text","spelling":"?"}]},"swiftGenerics":{"parameters":[{"name":"Element","index":0,"depth":0}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"first"},{"kind":"text","spelling":"<"},{"kind":"genericParameter","spelling":"Element"},{"kind":"text","spelling":">("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"items"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Element","preciseIdentifier":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF7ElementL_xmfp"},{"kind":"text","spelling":"]) -> "},{"kind":"typeIdentifier","spelling":"Element","preciseIdentifier":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF7ElementL_xmfp"},{"kind":"text","spelling":"?"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":120,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC14withCompletionyyys6ResultOySSAA10ShapeErrorOGcF","interfaceLanguage":"swift"},"pathComponents":["Loader","withCompletion(_:)"],"names":{"title":"withCompletion(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withCompletion"},{"kind":"text","spelling":"(("},{"kind":"typeIdentifier","spelling":"Result","preciseIdentifier":"s:s6ResultO"},{"kind":"text","spelling":"<"},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"ShapeError","preciseIdentifier":"s:9SwiftDemo10ShapeErrorO"},{"kind":"text","spelling":">) -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"completion","declarationFragments":[{"kind":"identifier","spelling":"completion"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@escaping"},{"kind":"text","spelling":" ("},{"kind":"typeIdentifier","spelling":"Result","preciseIdentifier":"s:s6ResultO"},{"kind":"text","spelling":"<"},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"ShapeError","preciseIdentifier":"s:9SwiftDemo10ShapeErrorO"},{"kind":"text","spelling":">) -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"withCompletion"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"completion"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@escaping"},{"kind":"text","spelling":" ("},{"kind":"typeIdentifier","spelling":"Result","preciseIdentifier":"s:s6ResultO"},{"kind":"text","spelling":"<"},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"ShapeError","preciseIdentifier":"s:9SwiftDemo10ShapeErrorO"},{"kind":"text","spelling":">) -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":122,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC4eachyyySiXEF","interfaceLanguage":"swift"},"pathComponents":["Loader","each(_:)"],"names":{"title":"each(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"each"},{"kind":"text","spelling":"(("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"body","declarationFragments":[{"kind":"identifier","spelling":"body"},{"kind":"text","spelling":": ("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"each"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"body"},{"kind":"text","spelling":": ("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":123,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC6lookup5table3keySiSgSDySSSiG_SStF","interfaceLanguage":"swift"},"pathComponents":["Loader","lookup(table:key:)"],"names":{"title":"lookup(table:key:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"lookup"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"table"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"], "},{"kind":"externalParam","spelling":"key"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"table","declarationFragments":[{"kind":"identifier","spelling":"table"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}]},{"name":"key","declarationFragments":[{"kind":"identifier","spelling":"key"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"?"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"lookup"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"table"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"], "},{"kind":"externalParam","spelling":"key"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"?"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":125,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC6updateyyAA5PointVzF","interfaceLanguage":"swift"},"pathComponents":["Loader","update(_:)"],"names":{"title":"update(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"update"},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"point","declarationFragments":[{"kind":"identifier","spelling":"point"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"update"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"point"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":127,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC10modernOnlyyyF","interfaceLanguage":"swift"},"pathComponents":["Loader","modernOnly()"],"names":{"title":"modernOnly()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"modernOnly"},{"kind":"text","spelling":"()"}]},"functionSignature":{"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"modernOnly"},{"kind":"text","spelling":"()"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":16,"minor":0}}],"location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":130,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC11legacyFetchyyF","interfaceLanguage":"swift"},"pathComponents":["Loader","legacyFetch()"],"names":{"title":"legacyFetch()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"legacyFetch"},{"kind":"text","spelling":"()"}]},"functionSignature":{"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"legacyFetch"},{"kind":"text","spelling":"()"}],"accessLevel":"public","availability":[{"domain":"*","message":"Use fetch(url:) instead","isUnconditionallyDeprecated":true}],"location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":133,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo6LoaderC8oldFetchyyF","interfaceLanguage":"swift"},"pathComponents":["Loader","oldFetch()"],"names":{"title":"oldFetch()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"oldFetch"},{"kind":"text","spelling":"()"}]},"functionSignature":{"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"oldFetch"},{"kind":"text","spelling":"()"}],"accessLevel":"public","availability":[{"domain":"iOS","introduced":{"major":15,"minor":0},"deprecated":{"major":17,"minor":0},"renamed":"fetch(url:)"}],"location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":136,"character":16}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo16makeDefaultPointAA0E0VyF","interfaceLanguage":"swift"},"pathComponents":["makeDefaultPoint()"],"names":{"title":"makeDefaultPoint()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeDefaultPoint"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeDefaultPoint"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":139,"character":12}}},{"kind":{"identifier":"swift.var","displayName":"Global Variable"},"identifier":{"precise":"s:9SwiftDemo13defaultFlavorAA0D0Ovp","interfaceLanguage":"swift"},"pathComponents":["defaultFlavor"],"names":{"title":"defaultFlavor","subHeading":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"defaultFlavor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Flavor","preciseIdentifier":"s:9SwiftDemo6FlavorO"}]},"declarationFragments":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"defaultFlavor"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Flavor","preciseIdentifier":"s:9SwiftDemo6FlavorO"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":140,"character":11}}},{"kind":{"identifier":"swift.var","displayName":"Global Variable"},"identifier":{"precise":"s:9SwiftDemo13globalCounterSivp","interfaceLanguage":"swift"},"pathComponents":["globalCounter"],"names":{"title":"globalCounter","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"globalCounter"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"globalCounter"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":141,"character":11}}},{"kind":{"identifier":"swift.typealias","displayName":"Type Alias"},"identifier":{"precise":"s:9SwiftDemo11Coordinatesa","interfaceLanguage":"swift"},"pathComponents":["Coordinates"],"names":{"title":"Coordinates","navigator":[{"kind":"identifier","spelling":"Coordinates"}],"subHeading":[{"kind":"keyword","spelling":"typealias"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Coordinates"}]},"declarationFragments":[{"kind":"keyword","spelling":"typealias"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Coordinates"},{"kind":"text","spelling":" = (latitude"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", longitude"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Shapes.swift","position":{"line":142,"character":17}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo11checkedSideyS2dKF","interfaceLanguage":"swift"},"pathComponents":["checkedSide(_:)"],"names":{"title":"checkedSide(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"checkedSide"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"functionSignature":{"parameters":[{"name":"side","declarationFragments":[{"kind":"identifier","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"checkedSide"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"side"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":5,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo8echoInt8ys0D0VADF","interfaceLanguage":"swift"},"pathComponents":["echoInt8(_:)"],"names":{"title":"echoInt8(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"echoInt8"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"}]},"functionSignature":{"parameters":[{"name":"value","declarationFragments":[{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"echoInt8"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Int8","preciseIdentifier":"s:s4Int8V"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":10,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo10echoUInt64ys0D0VADF","interfaceLanguage":"swift"},"pathComponents":["echoUInt64(_:)"],"names":{"title":"echoUInt64(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"echoUInt64"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"}]},"functionSignature":{"parameters":[{"name":"value","declarationFragments":[{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"}]}],"returns":[{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"echoUInt64"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"UInt64","preciseIdentifier":"s:s6UInt64V"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":11,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo10largestIntSiyF","interfaceLanguage":"swift"},"pathComponents":["largestInt()"],"names":{"title":"largestInt()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"largestInt"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"largestInt"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":12,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo5shoutySSSgACF","interfaceLanguage":"swift"},"pathComponents":["shout(_:)"],"names":{"title":"shout(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"shout"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"shout"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":13,"character":12}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo7TrackerC","interfaceLanguage":"swift"},"pathComponents":["Tracker"],"names":{"title":"Tracker","navigator":[{"kind":"identifier","spelling":"Tracker"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Tracker"}]},"declarationFragments":[{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Tracker"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":15,"character":19}}},{"kind":{"identifier":"swift.type.property","displayName":"Type Property"},"identifier":{"precise":"s:9SwiftDemo7TrackerC9liveCountSivpZ","interfaceLanguage":"swift"},"pathComponents":["Tracker","liveCount"],"names":{"title":"liveCount","subHeading":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"liveCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"static"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"liveCount"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { get }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":16,"character":35}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7TrackerC2idSivp","interfaceLanguage":"swift"},"pathComponents":["Tracker","id"],"names":{"title":"id","subHeading":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":17,"character":15}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7TrackerC2idACSi_tcfc","interfaceLanguage":"swift"},"pathComponents":["Tracker","init(id:)"],"names":{"title":"init(id:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"id","declarationFragments":[{"kind":"identifier","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":19,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7TrackerC4sameACyF","interfaceLanguage":"swift"},"pathComponents":["Tracker","same()"],"names":{"title":"same()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"same"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"same"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":26,"character":16}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo11delayedEcho_5afterS2S_SdtYaKF","interfaceLanguage":"swift"},"pathComponents":["delayedEcho(_:after:)"],"names":{"title":"delayedEcho(_:after:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"delayedEcho"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"after"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"text","declarationFragments":[{"kind":"identifier","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"after","internalName":"seconds","declarationFragments":[{"kind":"identifier","spelling":"seconds"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"delayedEcho"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"after"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"seconds"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"throws"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":29,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo16makeTrackerLater2idAA0D0CSi_tYaF","interfaceLanguage":"swift"},"pathComponents":["makeTrackerLater(id:)"],"names":{"title":"makeTrackerLater(id:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeTrackerLater"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}]},"functionSignature":{"parameters":[{"name":"id","declarationFragments":[{"kind":"identifier","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeTrackerLater"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":35,"character":12}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo7PaletteC","interfaceLanguage":"swift"},"pathComponents":["Palette"],"names":{"title":"Palette","navigator":[{"kind":"identifier","spelling":"Palette"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Palette"}]},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Palette"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":41,"character":19}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7PaletteC7strokesSivp","interfaceLanguage":"swift"},"pathComponents":["Palette","strokes"],"names":{"title":"strokes","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"strokes"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"strokes"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { get }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":42,"character":28}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo7PaletteCACycfc","interfaceLanguage":"swift"},"pathComponents":["Palette","init()"],"names":{"title":"init()","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}]},"functionSignature":{},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":43,"character":11}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7PaletteC6strokeSiyF","interfaceLanguage":"swift"},"pathComponents":["Palette","stroke()"],"names":{"title":"stroke()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"stroke"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"stroke"},{"kind":"text","spelling":"() -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":44,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo7PaletteC11strokeLaterSiyYaF","interfaceLanguage":"swift"},"pathComponents":["Palette","strokeLater()"],"names":{"title":"strokeLater()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"strokeLater"},{"kind":"text","spelling":"() "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"functionSignature":{"returns":[{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"strokeLater"},{"kind":"text","spelling":"() "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":48,"character":16}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo5namesySaySSGSiF","interfaceLanguage":"swift"},"pathComponents":["names(_:)"],"names":{"title":"names(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"names"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]"}]},"functionSignature":{"parameters":[{"name":"count","declarationFragments":[{"kind":"identifier","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"text","spelling":"["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"names"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":54,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo5totalySdSaySdGF","interfaceLanguage":"swift"},"pathComponents":["total(_:)"],"names":{"title":"total(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"total"},{"kind":"text","spelling":"(["},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":"]) -> "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"functionSignature":{"parameters":[{"name":"values","declarationFragments":[{"kind":"identifier","spelling":"values"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":"]"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"total"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"values"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":"]) -> "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":55,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo8centroid2ofAA5PointVSayAEG_tF","interfaceLanguage":"swift"},"pathComponents":["centroid(of:)"],"names":{"title":"centroid(of:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"centroid"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":"]) -> "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"functionSignature":{"parameters":[{"name":"of","internalName":"points","declarationFragments":[{"kind":"identifier","spelling":"points"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":"]"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"centroid"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"points"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":"]) -> "},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":56,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo8mirroredySaySaySiGGADF","interfaceLanguage":"swift"},"pathComponents":["mirrored(_:)"],"names":{"title":"mirrored(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"mirrored"},{"kind":"text","spelling":"([["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]]) -> [["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]]"}]},"functionSignature":{"parameters":[{"name":"grid","declarationFragments":[{"kind":"identifier","spelling":"grid"},{"kind":"text","spelling":": [["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]]"}]}],"returns":[{"kind":"text","spelling":"[["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]]"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"mirrored"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"grid"},{"kind":"text","spelling":": [["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]]) -> [["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]]"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":57,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo10wordCountsySDySSSiGSaySSGF","interfaceLanguage":"swift"},"pathComponents":["wordCounts(_:)"],"names":{"title":"wordCounts(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"wordCounts"},{"kind":"text","spelling":"(["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]) -> ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}]},"functionSignature":{"parameters":[{"name":"words","declarationFragments":[{"kind":"identifier","spelling":"words"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]"}]}],"returns":[{"kind":"text","spelling":"["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"wordCounts"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"words"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]) -> ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":58,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo7lengthsySDySSSiGSDyS2SGF","interfaceLanguage":"swift"},"pathComponents":["lengths(_:)"],"names":{"title":"lengths(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"lengths"},{"kind":"text","spelling":"(["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]) -> ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}]},"functionSignature":{"parameters":[{"name":"table","declarationFragments":[{"kind":"identifier","spelling":"table"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]"}]}],"returns":[{"kind":"text","spelling":"["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"lengths"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"table"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]) -> ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":" : "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":61,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo8trackersySayAA7TrackerCGSaySiGF","interfaceLanguage":"swift"},"pathComponents":["trackers(_:)"],"names":{"title":"trackers(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"trackers"},{"kind":"text","spelling":"(["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]) -> ["},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"},{"kind":"text","spelling":"]"}]},"functionSignature":{"parameters":[{"name":"ids","declarationFragments":[{"kind":"identifier","spelling":"ids"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}]}],"returns":[{"kind":"text","spelling":"["},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"},{"kind":"text","spelling":"]"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"trackers"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"ids"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]) -> ["},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"},{"kind":"text","spelling":"]"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":62,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo10allFlavorsSayAA6FlavorOGyF","interfaceLanguage":"swift"},"pathComponents":["allFlavors()"],"names":{"title":"allFlavors()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"allFlavors"},{"kind":"text","spelling":"() -> ["},{"kind":"typeIdentifier","spelling":"Flavor","preciseIdentifier":"s:9SwiftDemo6FlavorO"},{"kind":"text","spelling":"]"}]},"functionSignature":{"returns":[{"kind":"text","spelling":"["},{"kind":"typeIdentifier","spelling":"Flavor","preciseIdentifier":"s:9SwiftDemo6FlavorO"},{"kind":"text","spelling":"]"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"allFlavors"},{"kind":"text","spelling":"() -> ["},{"kind":"typeIdentifier","spelling":"Flavor","preciseIdentifier":"s:9SwiftDemo6FlavorO"},{"kind":"text","spelling":"]"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":63,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo7nextDay5after10Foundation4DateVAF_tF","interfaceLanguage":"swift"},"pathComponents":["nextDay(after:)"],"names":{"title":"nextDay(after:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"nextDay"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"after"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Date","preciseIdentifier":"s:10Foundation4DateV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Date","preciseIdentifier":"s:10Foundation4DateV"}]},"functionSignature":{"parameters":[{"name":"after","internalName":"date","declarationFragments":[{"kind":"identifier","spelling":"date"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Date","preciseIdentifier":"s:10Foundation4DateV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Date","preciseIdentifier":"s:10Foundation4DateV"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"nextDay"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"after"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"date"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Date","preciseIdentifier":"s:10Foundation4DateV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Date","preciseIdentifier":"s:10Foundation4DateV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":64,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo4host2ofSSSg10Foundation3URLV_tF","interfaceLanguage":"swift"},"pathComponents":["host(of:)"],"names":{"title":"host(of:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"host"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"of","internalName":"url","declarationFragments":[{"kind":"identifier","spelling":"url"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"host"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"url"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":65,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo7resolve_7against10Foundation3URLVSS_AFtF","interfaceLanguage":"swift"},"pathComponents":["resolve(_:against:)"],"names":{"title":"resolve(_:against:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"resolve"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"against"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"}]},"functionSignature":{"parameters":[{"name":"path","declarationFragments":[{"kind":"identifier","spelling":"path"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"against","internalName":"base","declarationFragments":[{"kind":"identifier","spelling":"base"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"resolve"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"path"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"against"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"base"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"URL","preciseIdentifier":"s:10Foundation3URLV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":66,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo8checksumySi10Foundation4DataVF","interfaceLanguage":"swift"},"pathComponents":["checksum(_:)"],"names":{"title":"checksum(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"checksum"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"functionSignature":{"parameters":[{"name":"data","declarationFragments":[{"kind":"identifier","spelling":"data"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"checksum"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"data"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":67,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo4rampy10Foundation4DataVSiF","interfaceLanguage":"swift"},"pathComponents":["ramp(_:)"],"names":{"title":"ramp(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"ramp"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"}]},"functionSignature":{"parameters":[{"name":"count","declarationFragments":[{"kind":"identifier","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"ramp"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Data","preciseIdentifier":"s:10Foundation4DataV"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":68,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo10namesLaterySaySSGSiYaF","interfaceLanguage":"swift"},"pathComponents":["namesLater(_:)"],"names":{"title":"namesLater(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"namesLater"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" -> ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]"}]},"functionSignature":{"parameters":[{"name":"count","declarationFragments":[{"kind":"identifier","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"text","spelling":"["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"namesLater"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" -> ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":69,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo9countdown4from_ySi_ySi_SbtXEtF","interfaceLanguage":"swift"},"pathComponents":["countdown(from:_:)"],"names":{"title":"countdown(from:_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"countdown"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"from"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":", ("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"from","internalName":"start","declarationFragments":[{"kind":"identifier","spelling":"start"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},{"name":"tick","declarationFragments":[{"kind":"identifier","spelling":"tick"},{"kind":"text","spelling":": ("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"countdown"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"from"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"start"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"tick"},{"kind":"text","spelling":": ("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"Bool","preciseIdentifier":"s:Sb"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":74,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo10greetLater_10completionySSSg_yADYbctF","interfaceLanguage":"swift"},"pathComponents":["greetLater(_:completion:)"],"names":{"title":"greetLater(_:completion:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greetLater"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?, "},{"kind":"externalParam","spelling":"completion"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@Sendable"},{"kind":"text","spelling":" ("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}]},{"name":"completion","declarationFragments":[{"kind":"identifier","spelling":"completion"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@escaping"},{"kind":"text","spelling":" "},{"kind":"attribute","spelling":"@Sendable"},{"kind":"text","spelling":" ("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"greetLater"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?, "},{"kind":"externalParam","spelling":"completion"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@escaping"},{"kind":"text","spelling":" "},{"kind":"attribute","spelling":"@Sendable"},{"kind":"text","spelling":" ("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":80,"character":12}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"s:9SwiftDemo8NotifierC","interfaceLanguage":"swift"},"pathComponents":["Notifier"],"names":{"title":"Notifier","navigator":[{"kind":"identifier","spelling":"Notifier"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Notifier"}]},"declarationFragments":[{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Notifier"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":86,"character":19}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo8NotifierCACycfc","interfaceLanguage":"swift"},"pathComponents":["Notifier","init()"],"names":{"title":"init()","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}]},"functionSignature":{},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":88,"character":11}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo8NotifierC5countSivp","interfaceLanguage":"swift"},"pathComponents":["Notifier","count"],"names":{"title":"count","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"count"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":89,"character":15}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo8NotifierC9subscribeyyySSYbcF","interfaceLanguage":"swift"},"pathComponents":["Notifier","subscribe(_:)"],"names":{"title":"subscribe(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"subscribe"},{"kind":"text","spelling":"("},{"kind":"attribute","spelling":"@Sendable"},{"kind":"text","spelling":" ("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"handler","declarationFragments":[{"kind":"identifier","spelling":"handler"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@escaping"},{"kind":"text","spelling":" "},{"kind":"attribute","spelling":"@Sendable"},{"kind":"text","spelling":" ("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"subscribe"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"handler"},{"kind":"text","spelling":": "},{"kind":"attribute","spelling":"@escaping"},{"kind":"text","spelling":" "},{"kind":"attribute","spelling":"@Sendable"},{"kind":"text","spelling":" ("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":90,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo8NotifierC7publishyySSF","interfaceLanguage":"swift"},"pathComponents":["Notifier","publish(_:)"],"names":{"title":"publish(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"publish"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"message","declarationFragments":[{"kind":"identifier","spelling":"message"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"publish"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"message"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":91,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo8NotifierC12publishLateryySSF","interfaceLanguage":"swift"},"pathComponents":["Notifier","publishLater(_:)"],"names":{"title":"publishLater(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"publishLater"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"message","declarationFragments":[{"kind":"identifier","spelling":"message"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"publishLater"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"message"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":92,"character":16}}},{"kind":{"identifier":"swift.method","displayName":"Instance Method"},"identifier":{"precise":"s:9SwiftDemo8NotifierC5clearyyF","interfaceLanguage":"swift"},"pathComponents":["Notifier","clear()"],"names":{"title":"clear()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"clear"},{"kind":"text","spelling":"()"}]},"functionSignature":{"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"clear"},{"kind":"text","spelling":"()"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":96,"character":16}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo4area2ofSdAA11MeasurementO_tF","interfaceLanguage":"swift"},"pathComponents":["area(of:)"],"names":{"title":"area(of:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"functionSignature":{"parameters":[{"name":"of","internalName":"measurement","declarationFragments":[{"kind":"identifier","spelling":"measurement"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"area"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"measurement"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":99,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo7measure_2byAA11MeasurementOSd_SdSgtF","interfaceLanguage":"swift"},"pathComponents":["measure(_:by:)"],"names":{"title":"measure(_:by:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"measure"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"}]},"functionSignature":{"parameters":[{"name":"width","declarationFragments":[{"kind":"identifier","spelling":"width"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},{"name":"by","internalName":"height","declarationFragments":[{"kind":"identifier","spelling":"height"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":"?"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"measure"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"width"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"by"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"height"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":"?) -> "},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":106,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo12measurementsSayAA11MeasurementOGyF","interfaceLanguage":"swift"},"pathComponents":["measurements()"],"names":{"title":"measurements()","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"measurements"},{"kind":"text","spelling":"() -> ["},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"},{"kind":"text","spelling":"]"}]},"functionSignature":{"returns":[{"kind":"text","spelling":"["},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"},{"kind":"text","spelling":"]"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"measurements"},{"kind":"text","spelling":"() -> ["},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"},{"kind":"text","spelling":"]"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":111,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo12measureLateryAA11MeasurementOSdYaF","interfaceLanguage":"swift"},"pathComponents":["measureLater(_:)"],"names":{"title":"measureLater(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"measureLater"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"}]},"functionSignature":{"parameters":[{"name":"width","declarationFragments":[{"kind":"identifier","spelling":"width"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"measureLater"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"width"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":113,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo9onMeasureyyyAA11MeasurementOXEF","interfaceLanguage":"swift"},"pathComponents":["onMeasure(_:)"],"names":{"title":"onMeasure(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"onMeasure"},{"kind":"text","spelling":"(("},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"body","declarationFragments":[{"kind":"identifier","spelling":"body"},{"kind":"text","spelling":": ("},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"onMeasure"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"body"},{"kind":"text","spelling":": ("},{"kind":"typeIdentifier","spelling":"Measurement","preciseIdentifier":"s:9SwiftDemo11MeasurementO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":118,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo7explainySSAA10ShapeErrorOF","interfaceLanguage":"swift"},"pathComponents":["explain(_:)"],"names":{"title":"explain(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"explain"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"ShapeError","preciseIdentifier":"s:9SwiftDemo10ShapeErrorO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"error","declarationFragments":[{"kind":"identifier","spelling":"error"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"ShapeError","preciseIdentifier":"s:9SwiftDemo10ShapeErrorO"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"explain"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"error"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"ShapeError","preciseIdentifier":"s:9SwiftDemo10ShapeErrorO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":120,"character":12}}},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo7FormulaO","interfaceLanguage":"swift"},"pathComponents":["Formula"],"names":{"title":"Formula","navigator":[{"kind":"identifier","spelling":"Formula"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Formula"}]},"declarationFragments":[{"kind":"keyword","spelling":"indirect"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Formula"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":128,"character":21}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo7FormulaO6numberyACSdcACmF","interfaceLanguage":"swift"},"pathComponents":["Formula","number(_:)"],"names":{"title":"Formula.number(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"number"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"number"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":129,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo7FormulaO3sumyA2C_ACtcACmF","interfaceLanguage":"swift"},"pathComponents":["Formula","sum(_:_:)"],"names":{"title":"Formula.sum(_:_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"sum"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"sum"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"},{"kind":"text","spelling":", "},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":130,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo7FormulaO6negateyA2CcACmF","interfaceLanguage":"swift"},"pathComponents":["Formula","negate(_:)"],"names":{"title":"Formula.negate(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"negate"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"negate"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":131,"character":9}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo7FormulaO5valueSdvp","interfaceLanguage":"swift"},"pathComponents":["Formula","value"],"names":{"title":"value","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Double","preciseIdentifier":"s:Sd"},{"kind":"text","spelling":" { "},{"kind":"keyword","spelling":"get"},{"kind":"text","spelling":" }"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":133,"character":15}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo8simplifyyAA7FormulaOADF","interfaceLanguage":"swift"},"pathComponents":["simplify(_:)"],"names":{"title":"simplify(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"simplify"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"}]},"functionSignature":{"parameters":[{"name":"formula","declarationFragments":[{"kind":"identifier","spelling":"formula"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"simplify"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"formula"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Formula","preciseIdentifier":"s:9SwiftDemo7FormulaO"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":142,"character":12}}},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo7PayloadO","interfaceLanguage":"swift"},"pathComponents":["Payload"],"names":{"title":"Payload","navigator":[{"kind":"identifier","spelling":"Payload"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Payload"}]},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Payload"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":144,"character":12}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo7PayloadO7trackeryAcA7TrackerCcACmF","interfaceLanguage":"swift"},"pathComponents":["Payload","tracker(_:)"],"names":{"title":"Payload.tracker(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"tracker"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"tracker"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":145,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo7PayloadO5pointyAcA5PointVcACmF","interfaceLanguage":"swift"},"pathComponents":["Payload","point(_:)"],"names":{"title":"Payload.point(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"point"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"point"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Point","preciseIdentifier":"s:9SwiftDemo5PointV"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":146,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo7PayloadO6flavoryAcA6FlavorOcACmF","interfaceLanguage":"swift"},"pathComponents":["Payload","flavor(_:)"],"names":{"title":"Payload.flavor(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"flavor"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Flavor","preciseIdentifier":"s:9SwiftDemo6FlavorO"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"flavor"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Flavor","preciseIdentifier":"s:9SwiftDemo6FlavorO"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":147,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo7PayloadO5maybeyACSiSgcACmF","interfaceLanguage":"swift"},"pathComponents":["Payload","maybe(_:)"],"names":{"title":"Payload.maybe(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"maybe"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"?)"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"maybe"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"?)"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":148,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo7PayloadO5namesyACSaySSGcACmF","interfaceLanguage":"swift"},"pathComponents":["Payload","names(_:)"],"names":{"title":"Payload.names(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"names"},{"kind":"text","spelling":"(["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"])"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"names"},{"kind":"text","spelling":"(["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"])"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":149,"character":9}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo4echoyAA7PayloadOADF","interfaceLanguage":"swift"},"pathComponents":["echo(_:)"],"names":{"title":"echo(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"echo"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"Payload","preciseIdentifier":"s:9SwiftDemo7PayloadO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Payload","preciseIdentifier":"s:9SwiftDemo7PayloadO"}]},"functionSignature":{"parameters":[{"name":"payload","declarationFragments":[{"kind":"identifier","spelling":"payload"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Payload","preciseIdentifier":"s:9SwiftDemo7PayloadO"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Payload","preciseIdentifier":"s:9SwiftDemo7PayloadO"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"echo"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"payload"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Payload","preciseIdentifier":"s:9SwiftDemo7PayloadO"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Payload","preciseIdentifier":"s:9SwiftDemo7PayloadO"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":152,"character":12}}},{"kind":{"identifier":"swift.enum","displayName":"Enumeration"},"identifier":{"precise":"s:9SwiftDemo3JobO","interfaceLanguage":"swift"},"pathComponents":["Job"],"names":{"title":"Job","navigator":[{"kind":"identifier","spelling":"Job"}],"subHeading":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Job"}]},"declarationFragments":[{"kind":"keyword","spelling":"enum"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Job"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":155,"character":12}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo3JobO3runyACyyccACmF","interfaceLanguage":"swift"},"pathComponents":["Job","run(_:)"],"names":{"title":"Job.run(_:)","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"run"},{"kind":"text","spelling":"(() -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"run"},{"kind":"text","spelling":"(() -> "},{"kind":"typeIdentifier","spelling":"Void","preciseIdentifier":"s:s4Voida"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":156,"character":9}}},{"kind":{"identifier":"swift.enum.case","displayName":"Case"},"identifier":{"precise":"s:9SwiftDemo3JobO4idleyA2CmF","interfaceLanguage":"swift"},"pathComponents":["Job","idle"],"names":{"title":"Job.idle","subHeading":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"idle"}]},"declarationFragments":[{"kind":"keyword","spelling":"case"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"idle"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":157,"character":9}}},{"kind":{"identifier":"swift.struct","displayName":"Structure"},"identifier":{"precise":"s:9SwiftDemo3JobO6TicketV","interfaceLanguage":"swift"},"pathComponents":["Job","Ticket"],"names":{"title":"Job.Ticket","navigator":[{"kind":"identifier","spelling":"Ticket"}],"subHeading":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Ticket"}]},"declarationFragments":[{"kind":"keyword","spelling":"struct"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Ticket"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":159,"character":18}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo3JobO6TicketV2idSivp","interfaceLanguage":"swift"},"pathComponents":["Job","Ticket","id"],"names":{"title":"id","subHeading":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]},"declarationFragments":[{"kind":"keyword","spelling":"var"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":160,"character":19}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo3JobO6TicketV2idAESi_tcfc","interfaceLanguage":"swift"},"pathComponents":["Job","Ticket","init(id:)"],"names":{"title":"init(id:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"id","declarationFragments":[{"kind":"identifier","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"id"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":161,"character":15}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo4bumpyySizF","interfaceLanguage":"swift"},"pathComponents":["bump(_:)"],"names":{"title":"bump(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"bump"},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"value","declarationFragments":[{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"bump"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":165,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo6append_2toySS_SaySSGztF","interfaceLanguage":"swift"},"pathComponents":["append(_:to:)"],"names":{"title":"append(_:to:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"append"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"to"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"])"}]},"functionSignature":{"parameters":[{"name":"word","declarationFragments":[{"kind":"identifier","spelling":"word"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},{"name":"to","internalName":"words","declarationFragments":[{"kind":"identifier","spelling":"words"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"]"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"append"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"word"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"to"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"words"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" ["},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"])"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":166,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo5halveyySizKF","interfaceLanguage":"swift"},"pathComponents":["halve(_:)"],"names":{"title":"halve(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"halve"},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"}]},"functionSignature":{"parameters":[{"name":"value","declarationFragments":[{"kind":"identifier","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"halve"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"value"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"throws"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":167,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo5clearyySSSgzF","interfaceLanguage":"swift"},"pathComponents":["clear(_:)"],"names":{"title":"clear(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"clear"},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?)"}]},"functionSignature":{"parameters":[{"name":"name","declarationFragments":[{"kind":"identifier","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"clear"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"name"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":"?)"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":171,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo12swapTrackersyyAA7TrackerCz_ADztF","interfaceLanguage":"swift"},"pathComponents":["swapTrackers(_:_:)"],"names":{"title":"swapTrackers(_:_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"swapTrackers"},{"kind":"text","spelling":"("},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"},{"kind":"text","spelling":", "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"a","declarationFragments":[{"kind":"identifier","spelling":"a"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}]},{"name":"b","declarationFragments":[{"kind":"identifier","spelling":"b"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"}]}],"returns":[{"kind":"text","spelling":"()"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"swapTrackers"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"a"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"},{"kind":"text","spelling":", "},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"b"},{"kind":"text","spelling":": "},{"kind":"keyword","spelling":"inout"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","spelling":"Tracker","preciseIdentifier":"s:9SwiftDemo7TrackerC"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Values.swift","position":{"line":172,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo8describeySSSo6UIViewCF","interfaceLanguage":"swift"},"pathComponents":["describe(_:)"],"names":{"title":"describe(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"describe"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"view","declarationFragments":[{"kind":"identifier","spelling":"view"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"describe"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"view"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Views.swift","position":{"line":5,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo9makeLabelySo7UILabelCSSF","interfaceLanguage":"swift"},"pathComponents":["makeLabel(_:)"],"names":{"title":"makeLabel(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeLabel"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"UILabel","preciseIdentifier":"c:objc(cs)UILabel"}]},"functionSignature":{"parameters":[{"name":"text","declarationFragments":[{"kind":"identifier","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"UILabel","preciseIdentifier":"c:objc(cs)UILabel"}]},"declarationFragments":[{"kind":"attribute","spelling":"@"},{"kind":"attribute","spelling":"MainActor","preciseIdentifier":"s:ScM"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeLabel"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"UILabel","preciseIdentifier":"c:objc(cs)UILabel"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Views.swift","position":{"line":7,"character":23}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo4tagsySaySiGSaySo6UIViewCGF","interfaceLanguage":"swift"},"pathComponents":["tags(_:)"],"names":{"title":"tags(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"tags"},{"kind":"text","spelling":"(["},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"},{"kind":"text","spelling":"]) -> ["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}]},"functionSignature":{"parameters":[{"name":"views","declarationFragments":[{"kind":"identifier","spelling":"views"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"},{"kind":"text","spelling":"]"}]}],"returns":[{"kind":"text","spelling":"["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"tags"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"views"},{"kind":"text","spelling":": ["},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"},{"kind":"text","spelling":"]) -> ["},{"kind":"typeIdentifier","spelling":"Int","preciseIdentifier":"s:Si"},{"kind":"text","spelling":"]"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Views.swift","position":{"line":13,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo12firstSubview2ofSo6UIViewCSgAE_tF","interfaceLanguage":"swift"},"pathComponents":["firstSubview(of:)"],"names":{"title":"firstSubview(of:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"firstSubview"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"},{"kind":"text","spelling":"?"}]},"functionSignature":{"parameters":[{"name":"of","internalName":"view","declarationFragments":[{"kind":"identifier","spelling":"view"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"}]}],"returns":[{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"},{"kind":"text","spelling":"?"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"firstSubview"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"view"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"UIView","preciseIdentifier":"c:objc(cs)UIView"},{"kind":"text","spelling":"?"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Views.swift","position":{"line":15,"character":12}}},{"kind":{"identifier":"swift.class","displayName":"Class"},"identifier":{"precise":"c:@M@SwiftDemo@objc(cs)Note","interfaceLanguage":"swift"},"pathComponents":["Note"],"names":{"title":"Note","navigator":[{"kind":"identifier","spelling":"Note"}],"subHeading":[{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Note"}]},"declarationFragments":[{"kind":"keyword","spelling":"final"},{"kind":"text","spelling":" "},{"kind":"keyword","spelling":"class"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"Note"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Views.swift","position":{"line":17,"character":19}}},{"kind":{"identifier":"swift.property","displayName":"Instance Property"},"identifier":{"precise":"s:9SwiftDemo4NoteC4textSSvp","interfaceLanguage":"swift"},"pathComponents":["Note","text"],"names":{"title":"text","subHeading":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"let"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Views.swift","position":{"line":18,"character":15}}},{"kind":{"identifier":"swift.init","displayName":"Initializer"},"identifier":{"precise":"s:9SwiftDemo4NoteC4textACSS_tcfc","interfaceLanguage":"swift"},"pathComponents":["Note","init(text:)"],"names":{"title":"init(text:)","subHeading":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}]},"functionSignature":{"parameters":[{"name":"text","declarationFragments":[{"kind":"identifier","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}]},"declarationFragments":[{"kind":"keyword","spelling":"init"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":")"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Views.swift","position":{"line":19,"character":11}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo8makeNoteyAA0D0CSSF","interfaceLanguage":"swift"},"pathComponents":["makeNote(_:)"],"names":{"title":"makeNote(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeNote"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Note","preciseIdentifier":"c:@M@SwiftDemo@objc(cs)Note"}]},"functionSignature":{"parameters":[{"name":"text","declarationFragments":[{"kind":"identifier","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Note","preciseIdentifier":"c:@M@SwiftDemo@objc(cs)Note"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"makeNote"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"Note","preciseIdentifier":"c:@M@SwiftDemo@objc(cs)Note"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Views.swift","position":{"line":22,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo4text2ofSSAA4NoteC_tF","interfaceLanguage":"swift"},"pathComponents":["text(of:)"],"names":{"title":"text(of:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"text"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Note","preciseIdentifier":"c:@M@SwiftDemo@objc(cs)Note"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"functionSignature":{"parameters":[{"name":"of","internalName":"note","declarationFragments":[{"kind":"identifier","spelling":"note"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Note","preciseIdentifier":"c:@M@SwiftDemo@objc(cs)Note"}]}],"returns":[{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"text"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"of"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"note"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"Note","preciseIdentifier":"c:@M@SwiftDemo@objc(cs)Note"},{"kind":"text","spelling":") -> "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Views.swift","position":{"line":23,"character":12}}},{"kind":{"identifier":"swift.func","displayName":"Function"},"identifier":{"precise":"s:9SwiftDemo9noteLateryAA4NoteCSSYaF","interfaceLanguage":"swift"},"pathComponents":["noteLater(_:)"],"names":{"title":"noteLater(_:)","subHeading":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"noteLater"},{"kind":"text","spelling":"("},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Note","preciseIdentifier":"c:@M@SwiftDemo@objc(cs)Note"}]},"functionSignature":{"parameters":[{"name":"text","declarationFragments":[{"kind":"identifier","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"}]}],"returns":[{"kind":"typeIdentifier","spelling":"Note","preciseIdentifier":"c:@M@SwiftDemo@objc(cs)Note"}]},"declarationFragments":[{"kind":"keyword","spelling":"func"},{"kind":"text","spelling":" "},{"kind":"identifier","spelling":"noteLater"},{"kind":"text","spelling":"("},{"kind":"externalParam","spelling":"_"},{"kind":"text","spelling":" "},{"kind":"internalParam","spelling":"text"},{"kind":"text","spelling":": "},{"kind":"typeIdentifier","spelling":"String","preciseIdentifier":"s:SS"},{"kind":"text","spelling":") "},{"kind":"keyword","spelling":"async"},{"kind":"text","spelling":" -> "},{"kind":"typeIdentifier","spelling":"Note","preciseIdentifier":"c:@M@SwiftDemo@objc(cs)Note"}],"accessLevel":"public","location":{"uri":"file://Sources/SwiftDemo/Views.swift","position":{"line":25,"character":12}}}],"relationships":[{"kind":"requirementOf","source":"s:9SwiftDemo7GreeterP5greet4nameS2S_tF","target":"s:9SwiftDemo7GreeterP"},{"kind":"conformsTo","source":"s:9SwiftDemo0B0C","target":"s:9SwiftDemo7GreeterP"},{"kind":"memberOf","source":"s:9SwiftDemo0B0CACycfc","target":"s:9SwiftDemo0B0C"},{"kind":"memberOf","source":"s:9SwiftDemo0B0C5greet4nameS2S_tF","target":"s:9SwiftDemo0B0C","sourceOrigin":{"identifier":"s:9SwiftDemo7GreeterP5greet4nameS2S_tF","displayName":"Greeter.greet(name:)"}},{"kind":"conformsTo","source":"s:9SwiftDemo5PointV","target":"s:s23CustomStringConvertibleP","targetFallback":"Swift.CustomStringConvertible"},{"kind":"memberOf","source":"s:9SwiftDemo5PointV1xSdvp","target":"s:9SwiftDemo5PointV"},{"kind":"memberOf","source":"s:9SwiftDemo5PointV1ySdvp","target":"s:9SwiftDemo5PointV"},{"kind":"memberOf","source":"s:9SwiftDemo5PointV1x1yACSd_Sdtcfc","target":"s:9SwiftDemo5PointV"},{"kind":"memberOf","source":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo6FlavorO","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp","displayName":"RawRepresentable.hashValue"}},{"kind":"memberOf","source":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo6FlavorO","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF","displayName":"RawRepresentable.hash(into:)"}},{"kind":"memberOf","source":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ","displayName":"Equatable.!=(_:_:)"}},{"kind":"memberOf","source":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ","displayName":"RawRepresentable.makeFromRawAttachmentValue(_:)"}},{"kind":"memberOf","source":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo6FlavorO","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp","displayName":"RawRepresentable.rawAttachmentValueRepresentation"}},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:SQ","targetFallback":"Swift.Equatable"},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:SH","targetFallback":"Swift.Hashable"},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:SY","targetFallback":"Swift.RawRepresentable"},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:s23CustomStringConvertibleP","targetFallback":"Swift.CustomStringConvertible"},{"kind":"memberOf","source":"s:9SwiftDemo6FlavorO7vanillayA2CmF","target":"s:9SwiftDemo6FlavorO"},{"kind":"memberOf","source":"s:9SwiftDemo6FlavorO9chocolateyA2CmF","target":"s:9SwiftDemo6FlavorO"},{"kind":"memberOf","source":"s:9SwiftDemo6FlavorO8rawValueACSgSi_tcfc","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:SY8rawValuexSg03RawB0Qz_tcfc","displayName":"RawRepresentable.init(rawValue:)"}},{"kind":"memberOf","source":"s:9SwiftDemo0B0C5greet4name5timesS2S_SitF","target":"s:9SwiftDemo0B0C"},{"kind":"memberOf","source":"s:9SwiftDemo0B0C7versionSSvpZ","target":"s:9SwiftDemo0B0C"},{"kind":"conformsTo","source":"s:9SwiftDemo5PointV","target":"s:s9EscapableP","targetFallback":"Swift.Escapable"},{"kind":"conformsTo","source":"s:9SwiftDemo5PointV","target":"s:s8CopyableP","targetFallback":"Swift.Copyable"},{"kind":"memberOf","source":"s:9SwiftDemo5PointV11descriptionSSvp","target":"s:9SwiftDemo5PointV","sourceOrigin":{"identifier":"s:s23CustomStringConvertibleP11descriptionSSvp","displayName":"CustomStringConvertible.description"}},{"kind":"memberOf","source":"s:9SwiftDemo5PointV6lengthSdvp","target":"s:9SwiftDemo5PointV"},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:s9EscapableP","targetFallback":"Swift.Escapable"},{"kind":"conformsTo","source":"s:9SwiftDemo6FlavorO","target":"s:s8CopyableP","targetFallback":"Swift.Copyable"},{"kind":"memberOf","source":"s:9SwiftDemo6FlavorO11descriptionSSvp","target":"s:9SwiftDemo6FlavorO","sourceOrigin":{"identifier":"s:s23CustomStringConvertibleP11descriptionSSvp","displayName":"CustomStringConvertible.description"}},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5StyleO","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO","target":"s:9SwiftDemo7PolygonC5StyleO","sourceOrigin":{"identifier":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp","displayName":"RawRepresentable.hashValue"}},{"kind":"memberOf","source":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO","target":"s:9SwiftDemo7PolygonC5StyleO","sourceOrigin":{"identifier":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF","displayName":"RawRepresentable.hash(into:)"}},{"kind":"memberOf","source":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO","target":"s:9SwiftDemo7PolygonC5StyleO","sourceOrigin":{"identifier":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ","displayName":"Equatable.!=(_:_:)"}},{"kind":"memberOf","source":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO","target":"s:9SwiftDemo7PolygonC5StyleO","sourceOrigin":{"identifier":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ","displayName":"RawRepresentable.makeFromRawAttachmentValue(_:)"}},{"kind":"memberOf","source":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO","target":"s:9SwiftDemo7PolygonC5StyleO","sourceOrigin":{"identifier":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp","displayName":"RawRepresentable.rawAttachmentValueRepresentation"}},{"kind":"conformsTo","source":"s:9SwiftDemo7PolygonC5StyleO","target":"s:SQ","targetFallback":"Swift.Equatable"},{"kind":"conformsTo","source":"s:9SwiftDemo7PolygonC5StyleO","target":"s:SH","targetFallback":"Swift.Hashable"},{"kind":"conformsTo","source":"s:9SwiftDemo7PolygonC5StyleO","target":"s:SY","targetFallback":"Swift.RawRepresentable"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5StyleO5solidyA2EmF","target":"s:9SwiftDemo7PolygonC5StyleO"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5StyleO6dashedyA2EmF","target":"s:9SwiftDemo7PolygonC5StyleO"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5StyleO8rawValueAESgSS_tcfc","target":"s:9SwiftDemo7PolygonC5StyleO","sourceOrigin":{"identifier":"s:SY8rawValuexSg03RawB0Qz_tcfc","displayName":"RawRepresentable.init(rawValue:)"}},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC7MetricsV","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC7MetricsV9perimeterSdvp","target":"s:9SwiftDemo7PolygonC7MetricsV"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC7MetricsV9perimeterAESd_tcfc","target":"s:9SwiftDemo7PolygonC7MetricsV"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5styleAC5StyleOvp","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC7metrics4sideAC7MetricsVSd_tF","target":"s:9SwiftDemo7PolygonC"},{"kind":"conformsTo","source":"s:9SwiftDemo5ShapeP","target":"s:9SwiftDemo7GreeterP"},{"kind":"requirementOf","source":"s:9SwiftDemo5ShapeP4areaSdvp","target":"s:9SwiftDemo5ShapeP"},{"kind":"requirementOf","source":"s:9SwiftDemo5ShapeP5sidesSivpZ","target":"s:9SwiftDemo5ShapeP"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC4nameSSvp","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC11vertexCountSivp","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC6sharedACvpZ","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC4name11vertexCountACSS_Sitcfc","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC4nameACSgSS_tcfc","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5scale2byySd_tF","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5scale2byySi_tF","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC5scale1x1yySd_SdtF","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC4makeACyFZ","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonC8describeySSACSgFZ","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo7PolygonCyAA5PointVSicip","target":"s:9SwiftDemo7PolygonC"},{"kind":"conformsTo","source":"s:9SwiftDemo6SquareC","target":"s:9SwiftDemo5ShapeP"},{"kind":"conformsTo","source":"s:9SwiftDemo6SquareC","target":"s:9SwiftDemo7GreeterP"},{"kind":"inheritsFrom","source":"s:9SwiftDemo6SquareC","target":"s:9SwiftDemo7PolygonC"},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC4sideSdvp","target":"s:9SwiftDemo6SquareC"},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC4sideACSd_tcfc","target":"s:9SwiftDemo6SquareC"},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC4areaSdvp","target":"s:9SwiftDemo6SquareC","sourceOrigin":{"identifier":"s:9SwiftDemo5ShapeP4areaSdvp","displayName":"Shape.area"}},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC5sidesSivpZ","target":"s:9SwiftDemo6SquareC","sourceOrigin":{"identifier":"s:9SwiftDemo5ShapeP5sidesSivpZ","displayName":"Shape.sides"}},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC5greet4nameS2S_tF","target":"s:9SwiftDemo6SquareC","sourceOrigin":{"identifier":"s:9SwiftDemo7GreeterP5greet4nameS2S_tF","displayName":"Greeter.greet(name:)"}},{"kind":"memberOf","source":"s:9SwiftDemo6SquareC5scale2byySd_tF","target":"s:9SwiftDemo6SquareC"},{"kind":"overrides","source":"s:9SwiftDemo6SquareC5scale2byySd_tF","target":"s:9SwiftDemo7PolygonC5scale2byySd_tF"},{"kind":"memberOf","source":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","target":"s:9SwiftDemo13PrecipitationO","sourceOrigin":{"identifier":"s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp","displayName":"RawRepresentable.hashValue"}},{"kind":"memberOf","source":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","target":"s:9SwiftDemo13PrecipitationO","sourceOrigin":{"identifier":"s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF","displayName":"RawRepresentable.hash(into:)"}},{"kind":"memberOf","source":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","target":"s:9SwiftDemo13PrecipitationO","sourceOrigin":{"identifier":"s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ","displayName":"Equatable.!=(_:_:)"}},{"kind":"memberOf","source":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","target":"s:9SwiftDemo13PrecipitationO","sourceOrigin":{"identifier":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ","displayName":"RawRepresentable.makeFromRawAttachmentValue(_:)"}},{"kind":"memberOf","source":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO","target":"s:9SwiftDemo13PrecipitationO","sourceOrigin":{"identifier":"s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp","displayName":"RawRepresentable.rawAttachmentValueRepresentation"}},{"kind":"conformsTo","source":"s:9SwiftDemo13PrecipitationO","target":"s:SQ","targetFallback":"Swift.Equatable"},{"kind":"conformsTo","source":"s:9SwiftDemo13PrecipitationO","target":"s:SH","targetFallback":"Swift.Hashable"},{"kind":"conformsTo","source":"s:9SwiftDemo13PrecipitationO","target":"s:SY","targetFallback":"Swift.RawRepresentable"},{"kind":"memberOf","source":"s:9SwiftDemo13PrecipitationO4rainyA2CmF","target":"s:9SwiftDemo13PrecipitationO"},{"kind":"memberOf","source":"s:9SwiftDemo13PrecipitationO4snowyA2CmF","target":"s:9SwiftDemo13PrecipitationO"},{"kind":"memberOf","source":"s:9SwiftDemo13PrecipitationO4noneyA2CmF","target":"s:9SwiftDemo13PrecipitationO"},{"kind":"memberOf","source":"s:9SwiftDemo13PrecipitationO8rawValueACSgSS_tcfc","target":"s:9SwiftDemo13PrecipitationO","sourceOrigin":{"identifier":"s:SY8rawValuexSg03RawB0Qz_tcfc","displayName":"RawRepresentable.init(rawValue:)"}},{"kind":"memberOf","source":"s:s5ErrorP10FoundationE20localizedDescriptionSSvp::SYNTHESIZED::s:9SwiftDemo10ShapeErrorO","target":"s:9SwiftDemo10ShapeErrorO","sourceOrigin":{"identifier":"s:s5ErrorP10FoundationE20localizedDescriptionSSvp","displayName":"Error.localizedDescription"}},{"kind":"conformsTo","source":"s:9SwiftDemo10ShapeErrorO","target":"s:s5ErrorP","targetFallback":"Swift.Error"},{"kind":"conformsTo","source":"s:9SwiftDemo10ShapeErrorO","target":"s:s8SendableP","targetFallback":"Swift.Sendable"},{"kind":"conformsTo","source":"s:9SwiftDemo10ShapeErrorO","target":"s:s16SendableMetatypeP","targetFallback":"Swift.SendableMetatype"},{"kind":"memberOf","source":"s:9SwiftDemo10ShapeErrorO11invalidSideyACSdcACmF","target":"s:9SwiftDemo10ShapeErrorO"},{"kind":"memberOf","source":"s:9SwiftDemo10ShapeErrorO12tooManySidesyACSi_SitcACmF","target":"s:9SwiftDemo10ShapeErrorO"},{"kind":"memberOf","source":"s:9SwiftDemo10ShapeErrorO7unknownyA2CmF","target":"s:9SwiftDemo10ShapeErrorO"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO6lengthyACSdcACmF","target":"s:9SwiftDemo11MeasurementO"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO4areayACSd_SdtcACmF","target":"s:9SwiftDemo11MeasurementO"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO4noneyA2CmF","target":"s:9SwiftDemo11MeasurementO"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO4UnitV","target":"s:9SwiftDemo11MeasurementO"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO4UnitV6symbolSSvp","target":"s:9SwiftDemo11MeasurementO4UnitV"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO4UnitV6symbolAESS_tcfc","target":"s:9SwiftDemo11MeasurementO4UnitV"},{"kind":"memberOf","source":"s:9SwiftDemo11MeasurementO6isNoneSbvp","target":"s:9SwiftDemo11MeasurementO"},{"kind":"memberOf","source":"s:9SwiftDemo4RingV5innerAA5PointVvp","target":"s:9SwiftDemo4RingV"},{"kind":"memberOf","source":"s:9SwiftDemo4RingV5outerAA5PointVvp","target":"s:9SwiftDemo4RingV"},{"kind":"memberOf","source":"s:9SwiftDemo4RingV5inner5outerAcA5PointV_AGtcfc","target":"s:9SwiftDemo4RingV"},{"kind":"memberOf","source":"s:9SwiftDemo4RingV6expand2byySd_tF","target":"s:9SwiftDemo4RingV"},{"kind":"memberOf","source":"s:9SwiftDemo4RingV1poiyA2C_ACtFZ","target":"s:9SwiftDemo4RingV"},{"kind":"memberOf","source":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pqd_0_YKXEqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SwiftDemo7CounterC","target":"s:9SwiftDemo7CounterC","sourceOrigin":{"identifier":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pqd_0_YKXEqd_0_YKs5ErrorRd_0_Ri_d__r0_lF","displayName":"Actor.withSerialExecutor(_:)"}},{"kind":"memberOf","source":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pYaqd_0_YKYCXEYaqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SwiftDemo7CounterC","target":"s:9SwiftDemo7CounterC","sourceOrigin":{"identifier":"s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pYaqd_0_YKYCXEYaqd_0_YKs5ErrorRd_0_Ri_d__r0_lF","displayName":"Actor.withSerialExecutor(_:)"}},{"kind":"memberOf","source":"s:ScA12_ConcurrencyE20preconditionIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SwiftDemo7CounterC","target":"s:9SwiftDemo7CounterC","sourceOrigin":{"identifier":"s:ScA12_ConcurrencyE20preconditionIsolated_4file4lineySSyXK_s12StaticStringVSutF","displayName":"Actor.preconditionIsolated(_:file:line:)"}},{"kind":"memberOf","source":"s:ScA12_ConcurrencyE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SwiftDemo7CounterC","target":"s:9SwiftDemo7CounterC","sourceOrigin":{"identifier":"s:ScA12_ConcurrencyE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF","displayName":"Actor.assertIsolated(_:file:line:)"}},{"kind":"memberOf","source":"s:ScA12_ConcurrencyE14assumeIsolated_4file4lineqd__qd__xYiKXE_s12StaticStringVSutKs8SendableRd__lF::SYNTHESIZED::s:9SwiftDemo7CounterC","target":"s:9SwiftDemo7CounterC","sourceOrigin":{"identifier":"s:ScA12_ConcurrencyE14assumeIsolated_4file4lineqd__qd__xYiKXE_s12StaticStringVSutKs8SendableRd__lF","displayName":"Actor.assumeIsolated(_:file:line:)"}},{"kind":"conformsTo","source":"s:9SwiftDemo7CounterC","target":"s:ScA","targetFallback":"_Concurrency.Actor"},{"kind":"conformsTo","source":"s:9SwiftDemo7CounterC","target":"s:s8SendableP","targetFallback":"Swift.Sendable"},{"kind":"conformsTo","source":"s:9SwiftDemo7CounterC","target":"s:s16SendableMetatypeP","targetFallback":"Swift.SendableMetatype"},{"kind":"memberOf","source":"s:9SwiftDemo7CounterC5valueSivp","target":"s:9SwiftDemo7CounterC"},{"kind":"memberOf","source":"s:9SwiftDemo7CounterC4stepSivp","target":"s:9SwiftDemo7CounterC"},{"kind":"memberOf","source":"s:9SwiftDemo7CounterCACycfc","target":"s:9SwiftDemo7CounterC"},{"kind":"memberOf","source":"s:9SwiftDemo7CounterC9incrementSiyF","target":"s:9SwiftDemo7CounterC"},{"kind":"memberOf","source":"s:9SwiftDemo7CounterC5labelSSyF","target":"s:9SwiftDemo7CounterC"},{"kind":"conformsTo","source":"s:9SwiftDemo6CanvasC","target":"s:s8SendableP","targetFallback":"Swift.Sendable"},{"kind":"memberOf","source":"s:9SwiftDemo6CanvasCACycfc","target":"s:9SwiftDemo6CanvasC"},{"kind":"memberOf","source":"s:9SwiftDemo6CanvasC4drawyyAA5Shape_pF","target":"s:9SwiftDemo6CanvasC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderCACycfc","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC4load4path10Foundation4DataVSS_tKF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC5fetch3urlSS10Foundation3URLV_tYaKF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC4wait7secondsySd_tYaF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC14withCompletionyyys6ResultOySSAA10ShapeErrorOGcF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC4eachyyySiXEF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC6lookup5table3keySiSgSDySSSiG_SStF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC6updateyyAA5PointVzF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC10modernOnlyyyF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC11legacyFetchyyF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo6LoaderC8oldFetchyyF","target":"s:9SwiftDemo6LoaderC"},{"kind":"memberOf","source":"s:9SwiftDemo7TrackerC9liveCountSivpZ","target":"s:9SwiftDemo7TrackerC"},{"kind":"memberOf","source":"s:9SwiftDemo7TrackerC2idSivp","target":"s:9SwiftDemo7TrackerC"},{"kind":"memberOf","source":"s:9SwiftDemo7TrackerC2idACSi_tcfc","target":"s:9SwiftDemo7TrackerC"},{"kind":"memberOf","source":"s:9SwiftDemo7TrackerC4sameACyF","target":"s:9SwiftDemo7TrackerC"},{"kind":"conformsTo","source":"s:9SwiftDemo7PaletteC","target":"s:s8SendableP","targetFallback":"Swift.Sendable"},{"kind":"memberOf","source":"s:9SwiftDemo7PaletteC7strokesSivp","target":"s:9SwiftDemo7PaletteC"},{"kind":"memberOf","source":"s:9SwiftDemo7PaletteCACycfc","target":"s:9SwiftDemo7PaletteC"},{"kind":"memberOf","source":"s:9SwiftDemo7PaletteC6strokeSiyF","target":"s:9SwiftDemo7PaletteC"},{"kind":"memberOf","source":"s:9SwiftDemo7PaletteC11strokeLaterSiyYaF","target":"s:9SwiftDemo7PaletteC"},{"kind":"conformsTo","source":"s:9SwiftDemo8NotifierC","target":"s:s8SendableP","targetFallback":"Swift.Sendable"},{"kind":"conformsTo","source":"s:9SwiftDemo8NotifierC","target":"s:s16SendableMetatypeP","targetFallback":"Swift.SendableMetatype"},{"kind":"memberOf","source":"s:9SwiftDemo8NotifierCACycfc","target":"s:9SwiftDemo8NotifierC"},{"kind":"memberOf","source":"s:9SwiftDemo8NotifierC5countSivp","target":"s:9SwiftDemo8NotifierC"},{"kind":"memberOf","source":"s:9SwiftDemo8NotifierC9subscribeyyySSYbcF","target":"s:9SwiftDemo8NotifierC"},{"kind":"memberOf","source":"s:9SwiftDemo8NotifierC7publishyySSF","target":"s:9SwiftDemo8NotifierC"},{"kind":"memberOf","source":"s:9SwiftDemo8NotifierC12publishLateryySSF","target":"s:9SwiftDemo8NotifierC"},{"kind":"memberOf","source":"s:9SwiftDemo8NotifierC5clearyyF","target":"s:9SwiftDemo8NotifierC"},{"kind":"memberOf","source":"s:9SwiftDemo7FormulaO6numberyACSdcACmF","target":"s:9SwiftDemo7FormulaO"},{"kind":"memberOf","source":"s:9SwiftDemo7FormulaO3sumyA2C_ACtcACmF","target":"s:9SwiftDemo7FormulaO"},{"kind":"memberOf","source":"s:9SwiftDemo7FormulaO6negateyA2CcACmF","target":"s:9SwiftDemo7FormulaO"},{"kind":"memberOf","source":"s:9SwiftDemo7FormulaO5valueSdvp","target":"s:9SwiftDemo7FormulaO"},{"kind":"memberOf","source":"s:9SwiftDemo7PayloadO7trackeryAcA7TrackerCcACmF","target":"s:9SwiftDemo7PayloadO"},{"kind":"memberOf","source":"s:9SwiftDemo7PayloadO5pointyAcA5PointVcACmF","target":"s:9SwiftDemo7PayloadO"},{"kind":"memberOf","source":"s:9SwiftDemo7PayloadO6flavoryAcA6FlavorOcACmF","target":"s:9SwiftDemo7PayloadO"},{"kind":"memberOf","source":"s:9SwiftDemo7PayloadO5maybeyACSiSgcACmF","target":"s:9SwiftDemo7PayloadO"},{"kind":"memberOf","source":"s:9SwiftDemo7PayloadO5namesyACSaySSGcACmF","target":"s:9SwiftDemo7PayloadO"},{"kind":"memberOf","source":"s:9SwiftDemo3JobO3runyACyyccACmF","target":"s:9SwiftDemo3JobO"},{"kind":"memberOf","source":"s:9SwiftDemo3JobO4idleyA2CmF","target":"s:9SwiftDemo3JobO"},{"kind":"memberOf","source":"s:9SwiftDemo3JobO6TicketV","target":"s:9SwiftDemo3JobO"},{"kind":"memberOf","source":"s:9SwiftDemo3JobO6TicketV2idSivp","target":"s:9SwiftDemo3JobO6TicketV"},{"kind":"memberOf","source":"s:9SwiftDemo3JobO6TicketV2idAESi_tcfc","target":"s:9SwiftDemo3JobO6TicketV"},{"kind":"conformsTo","source":"c:@M@SwiftDemo@objc(cs)Note","target":"c:objc(pl)NSObject","targetFallback":"ObjectiveC.NSObjectProtocol"},{"kind":"conformsTo","source":"c:@M@SwiftDemo@objc(cs)Note","target":"s:SQ","targetFallback":"Swift.Equatable"},{"kind":"conformsTo","source":"c:@M@SwiftDemo@objc(cs)Note","target":"s:SH","targetFallback":"Swift.Hashable"},{"kind":"conformsTo","source":"c:@M@SwiftDemo@objc(cs)Note","target":"s:s7CVarArgP","targetFallback":"Swift.CVarArg"},{"kind":"conformsTo","source":"c:@M@SwiftDemo@objc(cs)Note","target":"s:s23CustomStringConvertibleP","targetFallback":"Swift.CustomStringConvertible"},{"kind":"conformsTo","source":"c:@M@SwiftDemo@objc(cs)Note","target":"s:s28CustomDebugStringConvertibleP","targetFallback":"Swift.CustomDebugStringConvertible"},{"kind":"inheritsFrom","source":"c:@M@SwiftDemo@objc(cs)Note","target":"c:objc(cs)NSObject","targetFallback":"ObjectiveC.NSObject"},{"kind":"memberOf","source":"s:9SwiftDemo4NoteC4textSSvp","target":"c:@M@SwiftDemo@objc(cs)Note"},{"kind":"memberOf","source":"s:9SwiftDemo4NoteC4textACSS_tcfc","target":"c:@M@SwiftDemo@objc(cs)Note"}]} \ No newline at end of file diff --git a/metadata-generator/src/Swift/CapabilityClassifier.cpp b/metadata-generator/src/Swift/CapabilityClassifier.cpp index 4b8846c8..ca4fd9b8 100644 --- a/metadata-generator/src/Swift/CapabilityClassifier.cpp +++ b/metadata-generator/src/Swift/CapabilityClassifier.cpp @@ -50,6 +50,31 @@ bool isCallableKind(SymbolKind kind) { } } +bool hasAssociatedValues(const Module& module, const Symbol& symbol) { + if (symbol.kind != SymbolKind::Enum) { + return false; + } + for (const auto& id : symbol.memberIds) { + const Symbol* member = module.find(id); + if (member && member->kind == SymbolKind::EnumCase && + !member->parameters.empty()) { + return true; + } + } + return false; +} + +std::vector caseKeys(const Symbol& enumCase) { + std::vector keys; + const auto& parameters = enumCase.parameters; + for (size_t i = 0; i < parameters.size(); i++) { + keys.push_back(!parameters[i].label.empty() ? parameters[i].label + : parameters.size() == 1 ? "value" + : std::to_string(i)); + } + return keys; +} + namespace { std::string availabilityDomain(const Platform& platform) { @@ -124,6 +149,7 @@ class Classifier { _result.bySymbol[entry.first] = classifyType(entry.second); } } + rejectUnbridgedPayloads(); for (const auto& entry : _module.symbols) { if (!isNominalType(entry.second.kind)) { _result.bySymbol[entry.first] = classifyOther(entry.second); @@ -186,8 +212,17 @@ class Classifier { if (!symbol.genericParameters.empty()) { return make(Tier::SwiftSpecialized, "generic"); } - if (!symbol.parentId.empty()) { - return make(Tier::Unsupported, "nested-type"); + // A nested type is reached through its parent's JS path; it is generic + // when any enclosing type is. + for (const Symbol* current = &symbol; !current->parentId.empty();) { + const Symbol* parent = _module.find(current->parentId); + if (!parent) { + return make(Tier::Unsupported, "external-type-extension"); + } + if (!parent->genericParameters.empty()) { + return make(Tier::SwiftSpecialized, "generic"); + } + current = parent; } // Graphs show suppressed conformances only when the declaration spells // them; other noncopyable types are caught by compiler verification. @@ -197,16 +232,68 @@ class Classifier { if (llvm::StringRef(symbol.declarationText).contains("~Escapable")) { return make(Tier::Unsupported, "nonescapable"); } - if (symbol.kind == SymbolKind::Enum) { - for (const auto& id : symbol.memberIds) { - const Symbol* member = _module.find(id); - if (member && member->kind == SymbolKind::EnumCase && - !member->parameters.empty()) { - return make(Tier::Unsupported, "enum-associated-values"); + return make(Tier::SwiftGenerated); + } + + // An enum with associated values crosses whole, so every case JS may see + // must bridge. Payloads can name other such enums: demote until nothing + // changes. + void rejectUnbridgedPayloads() { + bool changed = true; + while (changed) { + changed = false; + for (const auto& entry : _module.symbols) { + const Symbol& symbol = entry.second; + Capability& capability = _result.bySymbol[entry.first]; + if (capability.tier != Tier::SwiftGenerated || + !hasAssociatedValues(_module, symbol)) { + continue; + } + std::vector reasons; + for (const auto& id : symbol.memberIds) { + const Symbol* member = _module.find(id); + if (!member || member->kind != SymbolKind::EnumCase || + isUnavailable(*member)) { + continue; + } + auto rejected = _rejections.find(member->preciseId); + if (rejected != _rejections.end()) { + reasons.push_back("compiler-rejected:" + rejected->second); + } + for (const auto& key : caseKeys(*member)) { + if (key == "case") { + reasons.push_back("js-name-conflict"); + } + } + std::set generics; + for (const auto& parameter : member->parameters) { + BridgedType bridged = bridge(parameter.type, generics, reasons); + if (bridged.bridge == Bridge::Closure) { + reasons.push_back("closure"); + } + } + } + if (!reasons.empty()) { + std::sort(reasons.begin(), reasons.end()); + reasons.erase(std::unique(reasons.begin(), reasons.end()), + reasons.end()); + capability = make(Tier::Unsupported, "enum-associated-values"); + capability.reasons.insert(capability.reasons.end(), reasons.begin(), + reasons.end()); + changed = true; } } } - return make(Tier::SwiftGenerated); + } + + bool isUnavailable(const Symbol& symbol) const { + for (const Availability* availability : + applicableAvailability(_module, symbol)) { + if (availability->isUnconditionallyUnavailable) { + return true; + } + } + return false; } Capability classifyOther(const Symbol& symbol) const { @@ -266,9 +353,16 @@ class Classifier { return make(Tier::Unsupported, "subscript"); } if (symbol.kind == SymbolKind::EnumCase) { - // Only payload-less enums are bridged (see classifyType). + // The owner bridged, so its payloads do (rejectUnbridgedPayloads). capability = make(Tier::SwiftGenerated); capability.jsName = symbol.baseName; + std::set generics; + std::vector reasons; + for (const auto& parameter : symbol.parameters) { + capability.parameters.push_back( + bridge(parameter.type, generics, reasons)); + } + capability.result = bridgeOwner(*owner); return capability; } @@ -276,23 +370,29 @@ class Classifier { return make(Tier::SwiftSpecialized, "generic"); } + // Isolation decides how a call is made, not whether it can be: actor + // members are awaited from outside their actor, main-actor members run + // only on the main thread. bool nonisolated = hasAttribute(symbol, "nonisolated"); - if (!nonisolated && (hasAttribute(symbol, "@MainActor") || - (owner && hasAttribute(*owner, "@MainActor")))) { - return make(Tier::Unsupported, "main-actor"); - } - if (owner && owner->kind == SymbolKind::Actor && !nonisolated && - !symbol.isStatic && symbol.kind != SymbolKind::Initializer) { - return make(Tier::Unsupported, "actor-isolated"); - } - if (symbol.isAsync) { - return make(Tier::Unsupported, "async"); - } + bool actorIsolated = owner && owner->kind == SymbolKind::Actor && + !nonisolated && !symbol.isStatic && + symbol.kind != SymbolKind::Initializer; + capability.isAsync = symbol.isAsync || actorIsolated; + if (capability.isAsync && symbol.kind == SymbolKind::Initializer) { + // `new` cannot await. + return make(Tier::Unsupported, "async-initializer"); + } + capability.isMainActor = + !nonisolated && (hasAttribute(symbol, "@MainActor") || + (owner && hasAttribute(*owner, "@MainActor"))); + // Another actor's state cannot be assigned from outside it. + capability.isSettable = symbol.isSettable && !capability.isAsync; std::set generics = genericNamesInScope(_module, symbol); std::vector reasons; for (const auto& parameter : symbol.parameters) { - if (parameter.modifier == "inout") { + // An async call returns before its arguments' final values exist. + if (parameter.modifier == "inout" && capability.isAsync) { reasons.push_back("inout-parameter"); continue; } @@ -306,6 +406,25 @@ class Classifier { continue; } BridgedType bridged = bridge(parameter.type, generics, reasons); + if (parameter.modifier == "inout") { + if (bridged.bridge == Bridge::Closure) { + reasons.push_back("inout-parameter"); + } + bridged.isInout = true; + } + if (bridged.bridge == Bridge::Closure) { + // The declaration parser lifts type attributes onto the parameter; + // the closure type needs them back (@Sendable, @MainActor). + TypeNode& node = + bridged.optional ? bridged.node.children[0] : bridged.node; + for (const auto& attribute : parameter.attributes) { + if (attribute == "@escaping") { + bridged.escaping = true; + } else if (!node.hasAttribute(attribute)) { + node.attributes.push_back(attribute); + } + } + } capability.parameters.push_back(std::move(bridged)); } @@ -316,8 +435,14 @@ class Classifier { capability.result = std::move(self); } else if (symbol.valueType) { capability.result = bridge(*symbol.valueType, generics, reasons); + if (capability.result.bridge == Bridge::Closure) { + reasons.push_back("closure"); + } } else if (symbol.returnType) { capability.result = bridge(*symbol.returnType, generics, reasons); + if (capability.result.bridge == Bridge::Closure) { + reasons.push_back("closure"); + } } else { capability.result.bridge = Bridge::Void; } @@ -328,13 +453,10 @@ class Classifier { bool onlyGeneric = std::all_of(reasons.begin(), reasons.end(), [](const std::string& r) { return r == "generic"; }); - return Capability{ - onlyGeneric ? Tier::SwiftSpecialized : Tier::Unsupported, - reasons, - "", - false, - {}, - {}}; + Capability rejected; + rejected.tier = onlyGeneric ? Tier::SwiftSpecialized : Tier::Unsupported; + rejected.reasons = reasons; + return rejected; } capability.tier = Tier::SwiftGenerated; @@ -347,9 +469,10 @@ class Classifier { BridgedType bridgeOwner(const Symbol& owner) const { BridgedType bridged; bridged.symbolId = owner.preciseId; - bridged.bridge = owner.kind == SymbolKind::Struct ? Bridge::StructBox - : owner.kind == SymbolKind::Enum ? Bridge::EnumCase - : Bridge::ClassHandle; + bridged.bridge = owner.kind == SymbolKind::Struct ? Bridge::StructBox + : owner.kind != SymbolKind::Enum ? Bridge::ClassHandle + : hasAssociatedValues(_module, owner) ? Bridge::TaggedEnum + : Bridge::EnumCase; TypeNode::Component component; component.name = owner.name; component.usr = owner.preciseId; @@ -385,6 +508,26 @@ class Classifier { return bridged; } + // Bridges a collection's element (value) type into `container.elements`. + std::string bridgeElement(const TypeNode& node, + BridgedType& container) const { + BridgedType element; + element.node = node; + if (node.kind == TypeNode::Kind::Optional || + node.kind == TypeNode::Kind::ImplicitlyUnwrappedOptional) { + return "optional-element"; + } + std::string reason = bridgeNonOptional(node, element); + if (reason.empty() && element.bridge == Bridge::Void) { + reason = "unbridged-type:Void"; + } + if (reason.empty() && element.bridge == Bridge::Closure) { + reason = "closure"; + } + container.elements.push_back(std::move(element)); + return reason; + } + // Returns the rejection reason, or "" with `bridged` filled in. std::string bridgeNonOptional(const TypeNode& node, BridgedType& bridged) const { @@ -394,13 +537,53 @@ class Classifier { return ""; case TypeNode::Kind::GenericParameter: return "generic"; - case TypeNode::Kind::Function: - return "closure"; + case TypeNode::Kind::Function: { + // JS functions stand in for closures that return nothing: a Swift + // caller cannot wait for a value from another thread's JS. + if (node.isAsync || node.isThrowing || + (!node.result.empty() && + node.result[0].kind != TypeNode::Kind::Void)) { + return "closure"; + } + bridged.bridge = Bridge::Closure; + for (const auto& parameter : node.children) { + BridgedType element; + element.node = parameter; + const TypeNode* inner = ¶meter; + if (!parameter.modifier.empty()) { + return "closure"; + } + if (inner->kind == TypeNode::Kind::Optional || + inner->kind == TypeNode::Kind::ImplicitlyUnwrappedOptional) { + element.optional = true; + inner = &inner->children[0]; + } + std::string reason = bridgeNonOptional(*inner, element); + if (reason.empty() && (element.bridge == Bridge::Void || + element.bridge == Bridge::Closure)) { + reason = "closure"; + } + if (!reason.empty()) { + return reason; + } + bridged.elements.push_back(std::move(element)); + } + return ""; + } case TypeNode::Kind::Tuple: return "tuple"; case TypeNode::Kind::Array: - case TypeNode::Kind::Dictionary: - return "collection"; + bridged.bridge = Bridge::Array; + return bridgeElement(node.children[0], bridged); + case TypeNode::Kind::Dictionary: { + const TypeNode& key = node.children[0]; + if (key.kind != TypeNode::Kind::Nominal || + key.usr() != KnownTypes::kString) { + return "dictionary-key"; + } + bridged.bridge = Bridge::Dictionary; + return bridgeElement(node.children[1], bridged); + } case TypeNode::Kind::Existential: case TypeNode::Kind::Composition: return "existential"; @@ -422,13 +605,31 @@ class Classifier { isPrimitive(usr, bridged.bridge)) { return ""; } + if (usr == KnownTypes::kDate) { + bridged.bridge = Bridge::Date; + return ""; + } + if (usr == KnownTypes::kURL) { + bridged.bridge = Bridge::URL; + return ""; + } + if (usr == KnownTypes::kData) { + bridged.bridge = Bridge::Data; + return ""; + } const Symbol* target = usr.empty() ? nullptr : _module.find(usr); + std::string objcClass = objcClassName(usr, target); + if (!objcClass.empty()) { + bridged.bridge = Bridge::ObjCObject; + bridged.objcClass = objcClass; + return ""; + } if (target) { const Capability* capability = _result.find(target->preciseId); if (capability && capability->tier == Tier::SwiftGenerated && target->kind != SymbolKind::Protocol) { - bridged = BridgedType{bridgeOwner(*target).bridge, bridged.optional, - target->preciseId, bridged.node}; + bridged.bridge = bridgeOwner(*target).bridge; + bridged.symbolId = target->preciseId; return ""; } return "unbridged-type:" + llvm::join(target->pathComponents, "."); @@ -441,6 +642,31 @@ class Classifier { return "unbridged-type:" + (qualified.empty() ? spelling(node) : qualified); } + // The runtime name of the Objective-C class `usr` names, or "" when it + // names no class. Swift classes keep their module-qualified name unless + // they declare @objc(Name). + std::string objcClassName(const std::string& usr, + const Symbol* target) const { + llvm::StringRef ref(usr); + if (ref.consume_front("c:objc(cs)")) { + return ref.str(); + } + size_t marker = ref.find("@objc(cs)"); + if (!ref.startswith("c:@M@") || marker == llvm::StringRef::npos) { + return ""; + } + if (target) { + for (const auto& attribute : target->attributes) { + llvm::StringRef text(attribute); + if (text.consume_front("@objc(") && text.consume_back(")")) { + return text.str(); + } + } + } + llvm::StringRef module = ref.substr(5).split('@').first; + return module.str() + "." + ref.substr(marker + 9).str(); + } + // JS names for SwiftGenerated members and overload ambiguity. void resolveNames() { struct Entry { @@ -499,6 +725,9 @@ class Classifier { } static std::string jsKind(const BridgedType& type) { + if (type.isInout) { + return "record"; + } std::string kind; switch (type.bridge) { case Bridge::Bool: @@ -516,6 +745,29 @@ class Classifier { case Bridge::StructBox: kind = "object:" + type.symbolId; break; + case Bridge::URL: + // A URL parameter also accepts a string. + kind = "string"; + break; + case Bridge::Date: + kind = "date"; + break; + case Bridge::Data: + kind = "bytes"; + break; + case Bridge::Array: + kind = "array"; + break; + case Bridge::Dictionary: + case Bridge::TaggedEnum: + kind = "record"; + break; + case Bridge::Closure: + kind = "function"; + break; + case Bridge::ObjCObject: + kind = "objc"; + break; default: kind = "other"; break; diff --git a/metadata-generator/src/Swift/CapabilityClassifier.h b/metadata-generator/src/Swift/CapabilityClassifier.h index db0bf8fd..ad2b8dd8 100644 --- a/metadata-generator/src/Swift/CapabilityClassifier.h +++ b/metadata-generator/src/Swift/CapabilityClassifier.h @@ -45,6 +45,25 @@ enum class Bridge { StructBox, // Module enum without payloads: its case name as a JS string. EnumCase, + // Module enum with associated values: a plain JS object copy naming its + // case, `{ case: "area", width: 3, height: 4 }` (see caseKeys). + TaggedEnum, + // Foundation.Date: a JS Date. + Date, + // Foundation.URL: a JS URL (a string is accepted as input). + URL, + // Foundation.Data: a Uint8Array copy (any ArrayBuffer or view as input). + Data, + // [T]: a JS array copy; `elements` holds T. + Array, + // [String: T]: a plain JS object copy; `elements` holds T. + Dictionary, + // A closure parameter returning Void: a JS function. `elements` holds the + // closure's parameters. + Closure, + // An Objective-C class instance: NativeScript's ordinary Objective-C + // wrapper, with the same identity Objective-C calls give it. + ObjCObject, }; struct BridgedType { @@ -52,7 +71,18 @@ struct BridgedType { bool optional = false; // Nominal bridges: the module symbol the type refers to. std::string symbolId; + // ObjCObject: the class's Objective-C runtime name. + std::string objcClass; TypeNode node; + // Array and Dictionary: the element (value) type. Closure: its + // parameters. + std::vector elements; + // Closure parameters declared @escaping (valid only in parameter + // position, so kept out of `node`). + bool escaping = false; + // An inout parameter: JS passes a reference object, `{ value }`, whose + // value is the argument and receives the final value. + bool isInout = false; }; struct Capability { @@ -61,20 +91,28 @@ struct Capability { // ("unbridged-type:Foundation.URL"). Codes: // objc-visible, not-public, unavailable, obsoleted, unknown-kind, // deinitializer, macro, extension-block, protocol, protocol-requirement, - // type-alias, associated-type, generic, nested-type, noncopyable, - // nonescapable, actor-isolated, - // main-actor, async, operator, subscript, enum-associated-values, + // type-alias, associated-type, generic, noncopyable, + // nonescapable, async-initializer, operator, subscript, + // enum-associated-values, // external-type-extension, owner-not-bridged, missing-owner, // js-name-conflict, // inout-parameter, variadic-parameter, closure, tuple, collection, // existential, opaque-type, metatype, unbridged-type, unparsed-type, - // nested-optional, compiler-rejected + // nested-optional, optional-element, dictionary-key, compiler-rejected std::vector reasons; // Property name, method name, or "constructor" for initializers. std::string jsName; // Another generated overload with the same JS name accepts the same JS // argument kinds, so JS-side dispatch must use the signature key. bool ambiguousOverload = false; + // The call completes asynchronously (an `async` declaration, or an actor + // member called from outside the actor): JS receives a Promise. + bool isAsync = false; + // Isolated to the main actor; synchronous calls must come from the main + // thread. + bool isMainActor = false; + // A property or variable JS can assign. + bool isSettable = false; // Bridges for SwiftGenerated callables: parameters in order, then the // result (or the property value type). @@ -97,6 +135,13 @@ Classification classify( // Whether `kind` is something JavaScript can call or read. bool isCallableKind(SymbolKind kind); +// Whether enum `symbol` has a case with associated values. +bool hasAssociatedValues(const Module& module, const Symbol& symbol); + +// The JS keys of an enum case's associated values: the label, or "value" +// for a lone unlabeled value, or the position. +std::vector caseKeys(const Symbol& enumCase); + // The availability entries that apply to `module`'s platform. std::vector applicableAvailability(const Module& module, const Symbol& symbol); diff --git a/metadata-generator/src/Swift/ProbeEmitter.cpp b/metadata-generator/src/Swift/ProbeEmitter.cpp index b4c7d668..6a57d543 100644 --- a/metadata-generator/src/Swift/ProbeEmitter.cpp +++ b/metadata-generator/src/Swift/ProbeEmitter.cpp @@ -1,5 +1,8 @@ #include "ProbeEmitter.h" +#include +#include + #include #include "SwiftSource.h" @@ -46,16 +49,11 @@ ProbeSource emitProbes(const Module& module, out.line("// the Swift-generated surface of module " + module.name + "."); out.line("import Foundation"); out.line("import " + module.name); - std::set overlays; - for (const auto& entry : module.symbols) { - const Capability* capability = classification.find(entry.first); - if (capability && capability->tier == Tier::SwiftGenerated && - !entry.second.declaringModule.empty()) { - overlays.insert(entry.second.declaringModule); - } - } - for (const auto& overlay : overlays) { - out.line("import " + overlay); + llvm::SmallVector imports; + std::string text = swiftImports(module, classification); + llvm::StringRef(text).split(imports, '\n', -1, false); + for (llvm::StringRef line : imports) { + out.line(line.str()); } out.line(""); @@ -116,8 +114,12 @@ ProbeSource emitProbes(const Module& module, if (!invocation.availability.empty()) { out.line("@available(" + invocation.availability + ")"); } + if (invocation.isMainActor) { + out.line("@MainActor"); + } out.line("func __nsProbe" + std::to_string(index++) + "(" + signature + - ")" + (invocation.isThrowing ? " throws" : "") + " {"); + ")" + (invocation.isAsync ? " async" : "") + + (invocation.isThrowing ? " throws" : "") + " {"); const std::string receiver = "receiver"; out.line(" let _: " + invocation.resultType + " = " + invocationExpression(invocation, receiver, arguments)); diff --git a/metadata-generator/src/Swift/ProbeVerifier.cpp b/metadata-generator/src/Swift/ProbeVerifier.cpp index 337c8452..0c43e965 100644 --- a/metadata-generator/src/Swift/ProbeVerifier.cpp +++ b/metadata-generator/src/Swift/ProbeVerifier.cpp @@ -8,6 +8,7 @@ #include #include "ProbeEmitter.h" +#include "ThunkEmitter.h" namespace Swift { @@ -41,6 +42,30 @@ std::map rejectionsFromLog( return rejections; } +std::map rejectionsFromThunkLog( + const std::string& log, const std::string& thunkPath, + const std::string& source, const Module& module, + std::vector& unmapped) { + // Every thunk and helper is preceded by a `// ` line. + llvm::SmallVector lines; + llvm::StringRef(source).split(lines, '\n'); + std::map lineToSymbol; + std::string current; + for (size_t i = 0; i < lines.size(); i++) { + llvm::StringRef line = lines[i]; + if (line.consume_front("// ")) { + std::string id = line.split(" (").first.str(); + if (module.find(id)) { + current = id; + } + } + if (!current.empty()) { + lineToSymbol[static_cast(i) + 1] = current; + } + } + return rejectionsFromLog(log, thunkPath, lineToSymbol, unmapped); +} + VerifyResult verifyWithCompiler(const Module& module, const VerifyOptions& options) { VerifyResult result; @@ -56,6 +81,9 @@ VerifyResult verifyWithCompiler(const Module& module, llvm::SmallString<256> probePath(options.workDirectory); llvm::sys::path::append(probePath, module.name + ".verify.swift"); + llvm::SmallString<256> thunkPath(options.workDirectory); + llvm::sys::path::append(thunkPath, + module.name + "+NativeScript.verify.swift"); llvm::SmallString<256> logPath(options.workDirectory); llvm::sys::path::append(logPath, module.name + ".verify.log"); llvm::sys::fs::create_directories(options.workDirectory); @@ -64,15 +92,19 @@ VerifyResult verifyWithCompiler(const Module& module, // only guards against a compiler that keeps reporting the same errors. for (int pass = 0; pass < 8; pass++) { result.classification = classify(module, result.rejections); + // The probes check every call; the thunks are what ships, including the + // helpers the probes do not exercise. ProbeSource probes = emitProbes(module, result.classification); - { + ThunkSource thunks = emitThunks(module, result.classification); + for (const auto& file : {std::make_pair(&probePath, &probes.source), + std::make_pair(&thunkPath, &thunks.source)}) { std::error_code error; - llvm::raw_fd_ostream out(probePath, error, llvm::sys::fs::OF_Text); + llvm::raw_fd_ostream out(*file.first, error, llvm::sys::fs::OF_Text); if (error) { - result.failure = probePath.str().str() + ": " + error.message(); + result.failure = file.first->str().str() + ": " + error.message(); return result; } - out << probes.source; + out << *file.second; } std::vector arguments(options.compiler.begin(), @@ -86,6 +118,7 @@ VerifyResult verifyWithCompiler(const Module& module, arguments.insert(arguments.end(), {"-F", path}); } arguments.push_back(probePath.str().str()); + arguments.push_back(thunkPath.str().str()); std::vector argv(arguments.begin(), arguments.end()); std::optional redirects[] = { std::nullopt, llvm::StringRef(logPath), llvm::StringRef(logPath)}; @@ -103,9 +136,12 @@ VerifyResult verifyWithCompiler(const Module& module, auto log = llvm::MemoryBuffer::getFile(logPath); std::vector unmapped; - auto rejections = - rejectionsFromLog(log ? (*log)->getBuffer().str() : "", - probePath.str().str(), probes.lineToSymbol, unmapped); + std::string text = log ? (*log)->getBuffer().str() : ""; + auto rejections = rejectionsFromLog(text, probePath.str().str(), + probes.lineToSymbol, unmapped); + auto thunkRejections = rejectionsFromThunkLog( + text, thunkPath.str().str(), thunks.source, module, unmapped); + rejections.insert(thunkRejections.begin(), thunkRejections.end()); if (!unmapped.empty()) { result.failure = "compiler errors outside any probe (see " + logPath.str().str() + "): " + unmapped.front(); diff --git a/metadata-generator/src/Swift/ProbeVerifier.h b/metadata-generator/src/Swift/ProbeVerifier.h index 459764aa..20acc597 100644 --- a/metadata-generator/src/Swift/ProbeVerifier.h +++ b/metadata-generator/src/Swift/ProbeVerifier.h @@ -32,9 +32,9 @@ struct VerifyResult { std::string failure; }; -// Classifies `module`, type-checks probes for the result, demotes every -// symbol whose probe the compiler rejects, and repeats until the probes -// type-check (demoting a type changes its members' classification). +// Classifies `module`, type-checks probes and thunks for the result, +// demotes every symbol whose code the compiler rejects, and repeats until +// both type-check (demoting a type changes its members' classification). VerifyResult verifyWithCompiler(const Module& module, const VerifyOptions& options); @@ -45,4 +45,11 @@ std::map rejectionsFromLog( const std::map& lineToSymbol, std::vector& unmapped); +// The same for errors in generated thunks (`thunkPath` holding `source`), +// attributed to the symbol whose `// ` comment precedes the line. +std::map rejectionsFromThunkLog( + const std::string& log, const std::string& thunkPath, + const std::string& source, const Module& module, + std::vector& unmapped); + } // namespace Swift diff --git a/metadata-generator/src/Swift/SwiftSource.cpp b/metadata-generator/src/Swift/SwiftSource.cpp index 828b90d1..18825876 100644 --- a/metadata-generator/src/Swift/SwiftSource.cpp +++ b/metadata-generator/src/Swift/SwiftSource.cpp @@ -2,6 +2,8 @@ #include +#include +#include #include namespace Swift { @@ -120,6 +122,100 @@ std::string availabilityCondition(const Module& module, const Symbol& symbol) { ", *"; } +namespace { + +// Symbol graphs do not say which module declares an Objective-C class; its +// prefix usually does. A wrong guess fails compiler verification. +const char* frameworkOfObjCClass(llvm::StringRef name) { + static const std::pair prefixes[] = { + {"UI", "UIKit"}, + {"NS", "Foundation"}, + {"CL", "CoreLocation"}, + {"AV", "AVFoundation"}, + {"MK", "MapKit"}, + {"CA", "QuartzCore"}, + {"WK", "WebKit"}, + {"PH", "Photos"}, + {"CN", "Contacts"}, + {"EK", "EventKit"}, + {"HK", "HealthKit"}, + {"GK", "GameKit"}, + {"SCN", "SceneKit"}, + {"SK", "SpriteKit"}, + {"MTL", "Metal"}, + {"MTK", "MetalKit"}, + {"AR", "ARKit"}, + {"CB", "CoreBluetooth"}, + {"CM", "CoreMotion"}, + {"CK", "CloudKit"}, + {"PK", "PassKit"}, + {"SF", "SafariServices"}, + {"UN", "UserNotifications"}, + {"VN", "Vision"}, + {"ML", "CoreML"}, + {"WC", "WatchConnectivity"}, + }; + const char* best = nullptr; + size_t length = 0; + for (const auto& prefix : prefixes) { + size_t size = strlen(prefix.first); + if (size > length && name.startswith(prefix.first) && name.size() > size && + name[size] >= 'A' && name[size] <= 'Z') { + best = prefix.second; + length = size; + } + } + return best; +} + +void collectObjCClasses(const BridgedType& type, std::set& out) { + if (type.bridge == Bridge::ObjCObject && + type.objcClass.find('.') == std::string::npos) { + out.insert(type.objcClass); + } + for (const auto& element : type.elements) { + collectObjCClasses(element, out); + } +} + +} // namespace + +std::string swiftImports(const Module& module, + const Classification& classification) { + std::set overlays; + std::set classes; + for (const auto& entry : module.symbols) { + const Capability* capability = classification.find(entry.first); + if (!capability || capability->tier != Tier::SwiftGenerated) { + continue; + } + if (!entry.second.declaringModule.empty()) { + overlays.insert(entry.second.declaringModule); + } + for (const auto& parameter : capability->parameters) { + collectObjCClasses(parameter, classes); + } + collectObjCClasses(capability->result, classes); + } + std::set frameworks; + for (const auto& name : classes) { + const char* framework = frameworkOfObjCClass(name); + if (framework && llvm::StringRef(framework) != "Foundation" && + !overlays.count(framework)) { + frameworks.insert(framework); + } + } + std::string out; + for (const auto& overlay : overlays) { + out += "import " + overlay + "\n"; + } + for (const auto& framework : frameworks) { + out += + "#if canImport(" + framework + ")\nimport " + framework + "\n#endif\n"; + } + return out; +} + Invocation describeInvocation(const Module& module, const Symbol& symbol, const Capability& capability) { Invocation invocation; @@ -128,14 +224,22 @@ Invocation describeInvocation(const Module& module, const Symbol& symbol, invocation.owner = owner ? ownerTypeText(module, *owner) : module.name; invocation.member = symbol.baseName; invocation.isThrowing = symbol.isThrowing; - invocation.isSettable = symbol.isSettable; + invocation.isAsync = capability.isAsync; + invocation.isMainActor = capability.isMainActor && !capability.isAsync; + invocation.isSettable = capability.isSettable; for (size_t i = 0; i < symbol.parameters.size(); i++) { invocation.labels.push_back(symbol.parameters[i].label); - invocation.parameterTypes.push_back( - i < capability.parameters.size() - ? typeText(capability.parameters[i], module) - : ""); + std::string type = i < capability.parameters.size() + ? typeText(capability.parameters[i], module) + : ""; + bool isInout = + i < capability.parameters.size() && capability.parameters[i].isInout; + if (i < capability.parameters.size() && capability.parameters[i].escaping) { + type = "@escaping " + type; + } + invocation.parameterTypes.push_back(isInout ? "inout " + type : type); + invocation.inoutParameters.push_back(isInout); } bool valueOwner = owner && (owner->kind == SymbolKind::Struct || @@ -195,7 +299,12 @@ std::string invocationExpression(const Invocation& invocation, } const std::string& label = i < invocation.labels.size() ? invocation.labels[i] : ""; - argumentList += label.empty() ? arguments[i] : label + ": " + arguments[i]; + std::string argument = + (i < invocation.inoutParameters.size() && invocation.inoutParameters[i] + ? "&" + : "") + + arguments[i]; + argumentList += label.empty() ? argument : label + ": " + argument; } std::string expression; @@ -216,11 +325,16 @@ std::string invocationExpression(const Invocation& invocation, break; case Invocation::Form::StaticProperty: case Invocation::Form::Variable: - case Invocation::Form::EnumCase: expression = invocation.owner + "." + member; break; + case Invocation::Form::EnumCase: + expression = invocation.owner + "." + member + + (arguments.empty() ? "" : "(" + argumentList + ")"); + break; } - return invocation.isThrowing ? "try " + expression : expression; + std::string effects = std::string(invocation.isThrowing ? "try " : "") + + (invocation.isAsync ? "await " : ""); + return effects + expression; } std::string assignmentStatement(const Invocation& invocation, diff --git a/metadata-generator/src/Swift/SwiftSource.h b/metadata-generator/src/Swift/SwiftSource.h index e0c7a49f..82f44376 100644 --- a/metadata-generator/src/Swift/SwiftSource.h +++ b/metadata-generator/src/Swift/SwiftSource.h @@ -19,6 +19,12 @@ std::string declaringModuleName(const Module& module, const Symbol& symbol); // `Module.Outer.Inner` for a module-local type. std::string qualifiedTypeName(const Module& module, const Symbol& symbol); +// The modules generated Swift imports besides Foundation and `module`: +// cross-import overlays, and frameworks of Objective-C classes in bridged +// signatures (as `#if canImport` blocks). +std::string swiftImports(const Module& module, + const Classification& classification); + // `name` escaped for use as a Swift identifier or member name. std::string swiftIdentifier(const std::string& name); @@ -43,9 +49,15 @@ struct Invocation { std::string member; std::vector labels; std::vector parameterTypes; + // Per parameter: passed `inout` (the argument is written `&name`). + std::vector inoutParameters; // Qualified result type ("Void" when there is none). std::string resultType; bool isThrowing = false; + // The call is awaited (`async`, or an actor member called from outside). + bool isAsync = false; + // Synchronous main-actor isolation: the caller must be on the main actor. + bool isMainActor = false; bool isSettable = false; // The receiver must be passed `inout` (mutating members and setters of // value types). @@ -63,7 +75,7 @@ Invocation describeInvocation(const Module& module, const Symbol& symbol, // deployment target, empty otherwise. std::string availabilityCondition(const Module& module, const Symbol& symbol); -// The expression that reads/calls the symbol, including `try`. +// The expression that reads/calls the symbol, including `try`/`await`. std::string invocationExpression(const Invocation& invocation, const std::string& receiver, const std::vector& arguments); diff --git a/metadata-generator/src/Swift/SwiftSurface.cpp b/metadata-generator/src/Swift/SwiftSurface.cpp index 98eed23d..0a4bd881 100644 --- a/metadata-generator/src/Swift/SwiftSurface.cpp +++ b/metadata-generator/src/Swift/SwiftSurface.cpp @@ -47,6 +47,17 @@ int SwiftSurface::indexOf(const std::string& symbolId) const { return it == typeIndex.end() ? -1 : it->second; } +std::vector SwiftSurface::casesOf( + int typeIndex) const { + std::vector cases; + for (const auto& member : members) { + if (member.kind == kEnumCase && member.owner == typeIndex) { + cases.push_back(&member); + } + } + return cases; +} + const TypeNode& unwrappedNode(const BridgedType& type) { const TypeNode& node = type.node; if (type.optional && !node.children.empty() && @@ -93,11 +104,40 @@ std::string signatureCode(const SwiftSurface& surface, case Bridge::EnumCase: code = "e" + std::to_string(surface.indexOf(type.symbolId)); break; + case Bridge::TaggedEnum: + code = "t" + std::to_string(surface.indexOf(type.symbolId)); + break; + case Bridge::ObjCObject: + code = "@" + type.objcClass; + break; + case Bridge::Date: + code = "D"; + break; + case Bridge::URL: + code = "U"; + break; + case Bridge::Data: + code = "B"; + break; + case Bridge::Array: + code = "[" + signatureCode(surface, type.elements.at(0)) + "]"; + break; + case Bridge::Dictionary: + code = "{" + signatureCode(surface, type.elements.at(0)) + "}"; + break; + case Bridge::Closure: { + code = "("; + for (size_t i = 0; i < type.elements.size(); i++) { + code += (i > 0 ? "," : "") + signatureCode(surface, type.elements[i]); + } + code += ")"; + break; + } case Bridge::None: code = "?"; break; } - return type.optional ? code + "?" : code; + return (type.isInout ? "&" : "") + (type.optional ? code + "?" : code); } SwiftSurface describeSurface(const Module& module, @@ -111,8 +151,10 @@ SwiftSurface describeSurface(const Module& module, continue; } SwiftSurface::TypeKind kind = - symbol.kind == SymbolKind::Struct ? SwiftSurface::kStruct - : symbol.kind == SymbolKind::Enum ? SwiftSurface::kEnum + symbol.kind == SymbolKind::Struct ? SwiftSurface::kStruct + : symbol.kind == SymbolKind::Enum + ? (hasAssociatedValues(module, symbol) ? SwiftSurface::kTaggedEnum + : SwiftSurface::kEnum) : symbol.kind == SymbolKind::Actor ? SwiftSurface::kActor : SwiftSurface::kClass; int index = static_cast(surface.types.size()); @@ -140,16 +182,15 @@ SwiftSurface describeSurface(const Module& module, member.kind = memberKind(symbol.kind); member.flags = (symbol.isThrowing ? SwiftSurface::kThrows : 0) | - (symbol.isSettable && member.kind != SwiftSurface::kEnumCase + (capability->isSettable && member.kind != SwiftSurface::kEnumCase ? SwiftSurface::kSettable : 0) | - (capability->ambiguousOverload ? SwiftSurface::kAmbiguous : 0); + (capability->ambiguousOverload ? SwiftSurface::kAmbiguous : 0) | + (capability->isAsync ? SwiftSurface::kAsync : 0) | + (capability->isMainActor && !capability->isAsync + ? SwiftSurface::kMainActor + : 0); member.result = capability->result; - if (member.kind == SwiftSurface::kEnumCase) { - member.result.bridge = Bridge::EnumCase; - member.result.symbolId = owner ? owner->preciseId : ""; - member.result.optional = false; - } for (size_t i = 0; i < capability->parameters.size(); i++) { member.signature += (i > 0 ? "," : "") + signatureCode(surface, capability->parameters[i]); diff --git a/metadata-generator/src/Swift/SwiftSurface.h b/metadata-generator/src/Swift/SwiftSurface.h index 6f84807c..c44ae350 100644 --- a/metadata-generator/src/Swift/SwiftSurface.h +++ b/metadata-generator/src/Swift/SwiftSurface.h @@ -14,7 +14,13 @@ namespace Swift { // (SwiftDefinitionWriter), so the two cannot disagree. Kinds, flags and // signature codes are those of NativeScript/runtime/SwiftInterop.h. struct SwiftSurface { - enum TypeKind { kClass = 0, kActor = 1, kStruct = 2, kEnum = 3 }; + enum TypeKind { + kClass = 0, + kActor = 1, + kStruct = 2, + kEnum = 3, + kTaggedEnum = 4, + }; enum MemberKind { kInitializer = 0, kInstanceMethod = 1, @@ -25,7 +31,13 @@ struct SwiftSurface { kVariable = 6, kEnumCase = 7, }; - enum Flags { kThrows = 1 << 0, kSettable = 1 << 1, kAmbiguous = 1 << 2 }; + enum Flags { + kThrows = 1 << 0, + kSettable = 1 << 1, + kAmbiguous = 1 << 2, + kAsync = 1 << 3, + kMainActor = 1 << 4, + }; struct Type { const Symbol* symbol; @@ -48,6 +60,10 @@ struct SwiftSurface { BridgedType result; }; + // A tagged enum's cases in registration order, which is the case index + // the runtime and the thunks share. + std::vector casesOf(int typeIndex) const; + std::vector types; std::vector members; @@ -60,7 +76,8 @@ struct SwiftSurface { SwiftSurface describeSurface(const Module& module, const Classification& classification); -// Signature code of one value ("i64", "o3?", ...). +// Signature code of one value ("i64", "o3?", "t2", "[s]", "{f64}", +// "(i64,s)", "&i64"...). std::string signatureCode(const SwiftSurface& surface, const BridgedType& type); // Signed/unsigned integer width of an Integer bridge: {code, Swift type, diff --git a/metadata-generator/src/Swift/ThunkEmitter.cpp b/metadata-generator/src/Swift/ThunkEmitter.cpp index fe6d8f0b..409630e4 100644 --- a/metadata-generator/src/Swift/ThunkEmitter.cpp +++ b/metadata-generator/src/Swift/ThunkEmitter.cpp @@ -60,40 +60,114 @@ class Emitter { return symbol ? qualifiedTypeName(_module, *symbol) : ""; } - // Swift expression reading slot `slot` as the non-optional value of - // `type`, for conversions that cannot fail. - std::string primitiveRead(const BridgedType& type, int slot) const { - std::string index = std::to_string(slot); + struct ValueExpression { + std::string code; + // The expression is optional: nil means the JS value did not convert. + bool failable; + }; + + // Swift expression reading slot `index` of `slots` as the non-optional + // value of `type`. Collections recurse through element closures. + ValueExpression valueExpression(const BridgedType& type, + const std::string& slots, + const std::string& index) const { + auto read = [&](const std::string& reader) { + return slots + "." + reader + "(" + index + ")"; + }; switch (type.bridge) { case Bridge::Bool: - return "rt.bool(" + index + ")"; + return {read("bool"), false}; case Bridge::Integer: { const IntegerWidth* info = integerWidth(type); std::string swiftType = info ? info->swiftType : "Int"; bool isSigned = !info || info->isSigned; - std::string raw = - isSigned ? "rt.int64(" + index + ")" : "rt.uint64(" + index + ")"; + std::string raw = read(isSigned ? "int64" : "uint64"); if (swiftType == "Int64" || swiftType == "UInt64") { - return raw; + return {raw, false}; } // The runtime has range-checked the value against the width. - return swiftType + "(truncatingIfNeeded: " + raw + ")"; + return {swiftType + "(truncatingIfNeeded: " + raw + ")", false}; } case Bridge::Floating: { const std::string& usr = unwrappedNode(type).usr(); if (usr == KnownTypes::kFloat) { - return "Float(rt.double(" + index + "))"; + return {"Float(" + read("double") + ")", false}; } if (usr == KnownTypes::kCGFloat) { - return "CGFloat(rt.double(" + index + "))"; + return {"CGFloat(" + read("double") + ")", false}; } - return "rt.double(" + index + ")"; + return {read("double"), false}; } case Bridge::String: - return "rt.string(" + index + ")"; - default: - return ""; + return {read("string"), false}; + case Bridge::Date: + return {"Date(timeIntervalSince1970: " + read("double") + " / 1000)", + false}; + case Bridge::URL: + return {"URL(string: " + read("string") + ")", true}; + case Bridge::Data: + return {read("bytes"), false}; + case Bridge::ClassHandle: + return {read("object") + " as? " + typeName(type.symbolId), true}; + case Bridge::ObjCObject: + return {read("object") + " as? " + valueTypeName(type), true}; + case Bridge::StructBox: + return {"(" + read("object") + " as? __NSBox<" + + typeName(type.symbolId) + ">)?.value", + true}; + case Bridge::EnumCase: + return {"__nsEnum" + std::to_string(typeIndexOf(type.symbolId)) + "(" + + read("string") + ")", + true}; + case Bridge::TaggedEnum: + return {"__nsReadCase" + std::to_string(typeIndexOf(type.symbolId)) + + "(" + slots + ", " + index + ")", + true}; + case Bridge::Array: + case Bridge::Dictionary: { + const BridgedType& element = type.elements.at(0); + ValueExpression inner = valueExpression(element, "s", "j"); + std::string reader = + type.bridge == Bridge::Array ? "__nsReadArray" : "__nsReadMap"; + // An explicit closure argument: trailing closures cannot appear in + // guard conditions. + return {reader + "(" + slots + ", " + index + + ", { (s: __NSSlots, j: Int) -> " + valueTypeName(element) + + "? in " + inner.code + " })", + true}; + } + case Bridge::Closure: { + // A closure that reports its arguments to the JS function; the + // explicit type keeps attributes (@Sendable, @MainActor) the + // parameter requires. + std::vector parameters; + std::vector reports; + for (size_t i = 0; i < type.elements.size(); i++) { + const BridgedType& element = type.elements[i]; + std::string name = "p" + std::to_string(i); + parameters.push_back(name + ": " + + swiftTypeText(element.node, _module)); + std::string report = returnValue(element, "r", name); + reports.push_back(element.optional + ? "if let " + name + " { " + report + + " } else { r.returnNull() }" + : report); + } + std::string closureType = swiftTypeText(unwrappedNode(type), _module); + std::string body = + reports.empty() ? "_ in" : "r in " + llvm::join(reports, "; "); + return {"{ () -> " + closureType + + " in let callback = __NSCallback(api: rt.api, handle: " + + read("callback") + "); return { (" + + llvm::join(parameters, ", ") + ") in callback.invoke { " + + body + " } } }()", + false}; + } + case Bridge::Void: + case Bridge::None: + break; } + return {"nil", true}; } // Lines binding `name` to argument `slot`; `label` describes it in errors. @@ -101,42 +175,46 @@ class Emitter { const std::string& name, const std::string& label) const { std::string index = std::to_string(slot); - std::string cast; - std::string expected; - switch (type.bridge) { - case Bridge::ClassHandle: - cast = "rt.object(" + index + ") as? " + typeName(type.symbolId); - expected = typeName(type.symbolId); - break; - case Bridge::StructBox: - cast = "(rt.object(" + index + ") as? __NSBox<" + - typeName(type.symbolId) + ">)?.value"; - expected = typeName(type.symbolId); - break; - case Bridge::EnumCase: - cast = "__nsEnum" + std::to_string(typeIndexOf(type.symbolId)) + - "(rt.string(" + index + "))"; - expected = "a case of " + typeName(type.symbolId); - break; - default: { - std::string read = primitiveRead(type, slot); - if (type.optional) { - return " let " + name + " = rt.isNull(" + index + - ") ? nil : " + read + "\n"; - } - return " let " + name + " = " + read + "\n"; + ValueExpression value = valueExpression(type, "rt.slots", index); + if (!value.failable) { + if (type.optional) { + return " let " + name + " = rt.slots.isNull(" + index + + ") ? nil : " + value.code + "\n"; } + return " let " + name + " = " + value.code + "\n"; } std::string failure = "return rt.throwTypeError(" + - quoted(label + " must be " + expected) + ")"; + quoted(label + " must be " + describe(type)) + ")"; if (!type.optional) { - return " guard let " + name + " = " + cast + " else { " + failure + + return " guard let " + name + " = " + value.code + " else { " + failure + " }\n"; } return " var " + name + ": " + valueTypeName(type) + "? = nil\n" + - " if !rt.isNull(" + index + ") {\n" + - " guard let value = " + cast + " else { " + failure + " }\n" + - " " + name + " = value\n" + " }\n"; + " if !rt.slots.isNull(" + index + ") {\n" + + " guard let value = " + value.code + " else { " + failure + + " }\n" + " " + name + " = value\n" + " }\n"; + } + + // How errors describe what a value must be. + std::string describe(const BridgedType& type) const { + switch (type.bridge) { + case Bridge::EnumCase: + case Bridge::TaggedEnum: + return "a case of " + typeName(type.symbolId); + case Bridge::URL: + return "a valid URL"; + case Bridge::Array: + return "an array of " + describe(type.elements.at(0)); + case Bridge::Dictionary: + return "an object whose values are " + describe(type.elements.at(0)); + case Bridge::ClassHandle: + case Bridge::StructBox: + return typeName(type.symbolId); + case Bridge::ObjCObject: + return "a " + valueTypeName(type); + default: + return valueTypeName(type); + } } std::string valueTypeName(const BridgedType& type) const { @@ -147,47 +225,68 @@ class Emitter { } // Statements returning `value` (a non-optional expression of `type`). - std::string returnValue(const BridgedType& type, + std::string returnValue(const BridgedType& type, const std::string& reporter, const std::string& value) const { switch (type.bridge) { case Bridge::Void: - return "rt.returnVoid()"; + return reporter + ".returnVoid()"; case Bridge::Bool: - return "rt.returnBool(" + value + ")"; + return reporter + ".returnBool(" + value + ")"; case Bridge::Integer: { const IntegerWidth* info = integerWidth(type); if (info && !info->isSigned) { - return "rt.returnUInt64(UInt64(" + value + "))"; + return reporter + ".returnUInt64(UInt64(" + value + "))"; } - return "rt.returnInt64(Int64(" + value + "))"; + return reporter + ".returnInt64(Int64(" + value + "))"; } case Bridge::Floating: - return "rt.returnDouble(Double(" + value + "))"; + return reporter + ".returnDouble(Double(" + value + "))"; case Bridge::String: - return "rt.returnString(" + value + ")"; + return reporter + ".returnString(" + value + ")"; case Bridge::ClassHandle: - return "rt.returnObject(" + value + ", __nsTypeIndex(" + value + ", " + - std::to_string(typeIndexOf(type.symbolId)) + "))"; + return reporter + ".returnObject(" + value + ", __nsTypeIndex(" + + value + ", " + std::to_string(typeIndexOf(type.symbolId)) + "))"; case Bridge::StructBox: - return "rt.returnObject(__NSBox(" + value + "), " + + return reporter + ".returnObject(__NSBox(" + value + "), " + std::to_string(typeIndexOf(type.symbolId)) + ")"; + case Bridge::ObjCObject: + return reporter + ".returnObjC(" + value + ")"; case Bridge::EnumCase: - return "rt.returnString(__nsEnumName" + + return reporter + ".returnString(__nsEnumName" + std::to_string(typeIndexOf(type.symbolId)) + "(" + value + "))"; + case Bridge::TaggedEnum: + return "__nsReportCase" + std::to_string(typeIndexOf(type.symbolId)) + + "(" + reporter + ", " + value + ")"; + case Bridge::Date: + return reporter + ".returnDouble(" + value + + ".timeIntervalSince1970 * 1000)"; + case Bridge::URL: + return reporter + ".returnString(" + value + ".absoluteString)"; + case Bridge::Data: + return reporter + ".returnBytes(" + value + ")"; + case Bridge::Array: + return reporter + ".returnArray(" + value + ") { element in " + + returnValue(type.elements.at(0), reporter, "element") + " }"; + case Bridge::Dictionary: + return reporter + ".returnMap(" + value + ") { key, element in " + + reporter + ".returnString(key); " + + returnValue(type.elements.at(0), reporter, "element") + " }"; + case Bridge::Closure: case Bridge::None: - return "rt.returnVoid()"; + return reporter + ".returnVoid()"; } - return "rt.returnVoid()"; + return reporter + ".returnVoid()"; } - std::string returnResult(const BridgedType& type, - const std::string& indent) const { + std::string returnResult(const BridgedType& type, const std::string& indent, + const std::string& reporter = "rt") const { if (type.optional) { return indent + "if let result {\n" + indent + " " + - returnValue(type, "result") + "\n" + indent + "} else {\n" + - indent + " rt.returnNull()\n" + indent + "}\n"; + returnValue(type, reporter, "result") + "\n" + indent + + "} else {\n" + indent + " " + reporter + ".returnNull()\n" + + indent + "}\n"; } - return indent + returnValue(type, "result") + "\n"; + return indent + returnValue(type, reporter, "result") + "\n"; } // Receiver binding for instance members; returns the receiver expression. @@ -202,9 +301,12 @@ class Emitter { return "box.value"; } if (owner.kind == SymbolKind::Enum) { - body += " guard let receiver = __nsEnum" + - std::to_string(typeIndexOf(owner.preciseId)) + - "(rt.string(0)) else { " + failure + " }\n"; + std::string index = std::to_string(typeIndexOf(owner.preciseId)); + body += hasAssociatedValues(_module, owner) + ? " guard let receiver = __nsReadCase" + index + + "(rt.slots, 0) else { " + failure + " }\n" + : " guard let receiver = __nsEnum" + index + + "(rt.string(0)) else { " + failure + " }\n"; return "receiver"; } body += " guard let receiver = rt.object(0) as? " + type + " else { " + @@ -231,6 +333,60 @@ class Emitter { quoted(symbol.name + " requires " + platformVersion) + ") }\n"; } + // `body` run on the main actor, after rejecting calls from other threads + // (assumeIsolated would trap). + std::string onMainActor(const Symbol& symbol, const std::string& body) const { + std::string indented; + llvm::SmallVector lines; + llvm::StringRef(body).split(lines, '\n', -1, false); + for (llvm::StringRef line : lines) { + indented += " " + line.str() + "\n"; + } + return " guard Thread.isMainThread else { return rt.throwMessage(" + + quoted( + symbol.name + + " is isolated to the main actor; call it on the main thread") + + ") }\n MainActor.assumeIsolated {\n" + indented + " }\n"; + } + + // Starts the call in a Task and settles the call's Promise from there. + // Arguments are read before the Task starts: their slots only live for + // the synchronous call. + std::string asyncCall(const Symbol* owner, bool hasReceiver, + const std::vector& arguments, + const std::string& expression, + const std::string& binding, + const std::string& resultType, + const BridgedType& result, bool throwing) const { + std::vector captured; + if (hasReceiver) { + captured.push_back( + owner && owner->kind == SymbolKind::Struct ? "box" : "receiver"); + } + captured.insert(captured.end(), arguments.begin(), arguments.end()); + + std::string code = " let completion = rt.beginAsync()\n"; + std::string unpack; + if (captured.size() == 1) { + code += " let captured = __NSUnchecked(" + captured[0] + ")\n"; + unpack = " let " + captured[0] + " = captured.value\n"; + } else if (!captured.empty()) { + std::string list = llvm::join(captured, ", "); + code += " let captured = __NSUnchecked((" + list + "))\n"; + unpack = " let (" + list + ") = captured.value\n"; + } + code += " Task {\n" + unpack; + if (throwing) { + code += " do {\n let " + binding + ": " + resultType + " = " + + expression + "\n" + returnResult(result, " ", "completion") + + " } catch {\n completion.throwError(error)\n }\n"; + } else { + code += " let " + binding + ": " + resultType + " = " + expression + + "\n" + returnResult(result, " ", "completion"); + } + return code + " }\n"; + } + std::string emitMember(const SwiftSurface::Member& member) { const Symbol& symbol = *member.symbol; const Capability& capability = *member.capability; @@ -263,24 +419,54 @@ class Emitter { receiver = bindReceiver(*owner, code); } std::vector arguments; + // Reports of inout arguments' final values, after a successful call. + std::string writeBacks; for (size_t i = 0; i < capability.parameters.size(); i++) { + const BridgedType& parameter = capability.parameters[i]; std::string name = "a" + std::to_string(i); - code += readArgument(capability.parameters[i], - firstArgument + static_cast(i), name, + std::string read = parameter.isInout ? "v" + std::to_string(i) : name; + code += readArgument(parameter, firstArgument + static_cast(i), read, "argument " + std::to_string(i + 1)); + if (parameter.isInout) { + code += " var " + name + " = " + read + "\n"; + std::string statement = returnValue(parameter, "rt", name); + writeBacks += + "rt.writeBack(" + std::to_string(i) + ") { " + + (parameter.optional ? "if let " + name + " { " + statement + + " } else { rt.returnNull() }" + : statement) + + " }\n"; + } arguments.push_back(name); } std::string expression = invocationExpression(invocation, receiver, arguments); std::string binding = result.bridge == Bridge::Void ? "_" : "result"; std::string resultType = invocation.resultType; - if (symbol.isThrowing) { - code += " do {\n let " + binding + ": " + resultType + " = " + - expression + "\n" + returnResult(result, " ") + - " } catch {\n rt.throwError(error)\n }\n"; + if (invocation.isAsync) { + code += asyncCall(owner, hasReceiver, arguments, expression, binding, + resultType, result, symbol.isThrowing); } else { - code += " let " + binding + ": " + resultType + " = " + expression + - "\n" + returnResult(result, " "); + auto indented = [&](const std::string& indent) { + std::string out; + llvm::SmallVector lines; + llvm::StringRef(writeBacks).split(lines, '\n', -1, false); + for (llvm::StringRef line : lines) { + out += indent + line.str() + "\n"; + } + return out; + }; + std::string body; + if (symbol.isThrowing) { + body = " do {\n let " + binding + ": " + resultType + " = " + + expression + "\n" + indented(" ") + + returnResult(result, " ") + + " } catch {\n rt.throwError(error)\n }\n"; + } else { + body = " let " + binding + ": " + resultType + " = " + expression + + "\n" + indented(" ") + returnResult(result, " "); + } + code += invocation.isMainActor ? onMainActor(symbol, body) : body; } code += "}\n\n"; @@ -296,10 +482,11 @@ class Emitter { } code += readArgument(capability.result, firstArgument, "newValue", "value"); - code += " " + - assignmentStatement(invocation, setterReceiver, "newValue") + - "\n"; - code += " rt.returnVoid()\n}\n\n"; + std::string body = + " " + assignmentStatement(invocation, setterReceiver, "newValue") + + "\n rt.returnVoid()\n"; + code += invocation.isMainActor ? onMainActor(symbol, body) : body; + code += "}\n\n"; setterName = "__nsThunk" + std::to_string(setterIndex); } @@ -330,18 +517,7 @@ class Emitter { "import Foundation\n" "import " + _module.name + "\n"; - std::set overlays; - for (const auto& entry : _module.symbols) { - const Capability* capability = _classification.find(entry.first); - if (capability && capability->tier == Tier::SwiftGenerated && - !entry.second.declaringModule.empty()) { - overlays.insert(entry.second.declaringModule); - } - } - for (const auto& overlay : overlays) { - out += "import " + overlay + "\n"; - } - return out + "\n"; + return out + swiftImports(_module, _classification) + "\n"; } static std::string support() { @@ -353,29 +529,101 @@ private final class __NSBox { init(_ value: Value) { self.value = value } } +// The result entries calls and completions share, so value reporting code +// serves both. +private protocol __NSReporter { + func returnVoid() + func returnBool(_ value: Bool) + func returnInt64(_ value: Int64) + func returnUInt64(_ value: UInt64) + func returnDouble(_ value: Double) + func returnString(_ value: String) + func returnNull() + func returnBytes(_ value: Data) + func returnArray(_ values: Elements, _ each: (Elements.Element) -> Void) + func returnMap(_ values: [String: Value], _ each: (String, Value) -> Void) + func returnObject(_ object: AnyObject, _ typeIndex: UInt32) + func returnCase(_ index: Int, _ values: () -> Void) + func returnObjC(_ object: AnyObject) +} + // Reads arguments (24-byte slots) and reports results through the runtime's // API table, whose address is the first word of the call context. -private struct __NSCall { +// 24-byte argument slots: tag at 0, payload at 8, length at 16. Arrays and +// maps point at their own slots (a map's are key, value, key, value, ...). +private struct __NSSlots { + let base: UnsafeRawPointer? + + func isNull(_ i: Int) -> Bool { base!.load(fromByteOffset: i * 24, as: UInt32.self) == 0 } + func bool(_ i: Int) -> Bool { base!.load(fromByteOffset: i * 24 + 8, as: UInt8.self) != 0 } + func int64(_ i: Int) -> Int64 { base!.load(fromByteOffset: i * 24 + 8, as: Int64.self) } + func uint64(_ i: Int) -> UInt64 { base!.load(fromByteOffset: i * 24 + 8, as: UInt64.self) } + func double(_ i: Int) -> Double { base!.load(fromByteOffset: i * 24 + 8, as: Double.self) } + private func buffer(_ i: Int) -> UnsafeBufferPointer { + let start = base!.load(fromByteOffset: i * 24 + 8, as: UnsafePointer?.self) + let length = Int(base!.load(fromByteOffset: i * 24 + 16, as: UInt64.self)) + return UnsafeBufferPointer(start: start, count: length) + } + func string(_ i: Int) -> String { String(decoding: buffer(i), as: UTF8.self) } + func bytes(_ i: Int) -> Data { Data(buffer(i)) } + func object(_ i: Int) -> AnyObject { + let pointer = base!.load(fromByteOffset: i * 24 + 8, as: UnsafeMutableRawPointer.self) + return Unmanaged.fromOpaque(pointer).takeUnretainedValue() + } + func callback(_ i: Int) -> UnsafeMutableRawPointer { + base!.load(fromByteOffset: i * 24 + 8, as: UnsafeMutableRawPointer.self) + } + func elements(_ i: Int) -> (__NSSlots, Int) { + let start = base!.load(fromByteOffset: i * 24 + 8, as: UnsafeRawPointer?.self) + return (__NSSlots(base: start), Int(base!.load(fromByteOffset: i * 24 + 16, as: UInt64.self))) + } +} + +// nil when an element does not convert. +private func __nsReadArray(_ slots: __NSSlots, _ i: Int, + _ read: (__NSSlots, Int) -> Element?) -> [Element]? { + let (elements, count) = slots.elements(i) + var result: [Element] = [] + result.reserveCapacity(count) + for j in 0..(_ slots: __NSSlots, _ i: Int, + _ read: (__NSSlots, Int) -> Value?) -> [String: Value]? { + let (entries, count) = slots.elements(i) + var result: [String: Value] = [:] + result.reserveCapacity(count) + for j in 0..(_ index: Int, _: Function.Type) -> Function { call.load(as: UnsafeRawPointer.self).load(fromByteOffset: index * 8, as: Function.self) } - func isNull(_ i: Int) -> Bool { args!.load(fromByteOffset: i * 24, as: UInt32.self) == 0 } - func bool(_ i: Int) -> Bool { args!.load(fromByteOffset: i * 24 + 8, as: UInt8.self) != 0 } - func int64(_ i: Int) -> Int64 { args!.load(fromByteOffset: i * 24 + 8, as: Int64.self) } - func uint64(_ i: Int) -> UInt64 { args!.load(fromByteOffset: i * 24 + 8, as: UInt64.self) } - func double(_ i: Int) -> Double { args!.load(fromByteOffset: i * 24 + 8, as: Double.self) } - func string(_ i: Int) -> String { - let base = args!.load(fromByteOffset: i * 24 + 8, as: UnsafePointer?.self) - let length = Int(args!.load(fromByteOffset: i * 24 + 16, as: UInt64.self)) - return String(decoding: UnsafeBufferPointer(start: base, count: length), as: UTF8.self) - } - func object(_ i: Int) -> AnyObject { - let pointer = args!.load(fromByteOffset: i * 24 + 8, as: UnsafeMutableRawPointer.self) - return Unmanaged.fromOpaque(pointer).takeUnretainedValue() + var api: UnsafeRawPointer { call.load(as: UnsafeRawPointer.self) } + func string(_ i: Int) -> String { slots.string(i) } + func object(_ i: Int) -> AnyObject { slots.object(i) } + + func beginAsync() -> __NSCompletion { + let token = slot(13, (@convention(c) (UnsafeMutableRawPointer) -> UnsafeMutableRawPointer).self)(call) + return __NSCompletion(api: call.load(as: UnsafeRawPointer.self), token: token) } func returnVoid() { @@ -403,10 +651,44 @@ private struct __NSCall { func returnNull() { slot(6, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(call) } + func returnBytes(_ value: Data) { + value.withUnsafeBytes { + slot(5, (@convention(c) (UnsafeMutableRawPointer, UnsafePointer?, Int) -> Void).self)( + call, $0.bindMemory(to: UInt8.self).baseAddress, $0.count) + } + } + // Each element is reported with the ordinary return* entries. + func returnArray(_ values: Elements, _ each: (Elements.Element) -> Void) { + slot(23, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(call, values.count) + for value in values { each(value) } + slot(24, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(call) + } + // `each` reports the key (a string), then the value. + func returnMap(_ values: [String: Value], _ each: (String, Value) -> Void) { + slot(25, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(call, values.count) + for (key, value) in values { each(key, value) } + slot(26, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(call) + } + // `values` reports the case's associated values in order. + func returnCase(_ index: Int, _ values: () -> Void) { + slot(34, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(call, index) + values() + slot(36, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(call) + } + // `value` reports the final value of inout argument `index`. + func writeBack(_ index: Int, _ value: () -> Void) { + slot(38, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(call, index) + value() + slot(39, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(call) + } func returnObject(_ object: AnyObject, _ typeIndex: UInt32) { slot(7, (@convention(c) (UnsafeMutableRawPointer, UnsafeMutableRawPointer, UInt32) -> Void).self)( call, Unmanaged.passRetained(object).toOpaque(), typeIndex) } + func returnObjC(_ object: AnyObject) { + slot(40, (@convention(c) (UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> Void).self)( + call, Unmanaged.passRetained(object).toOpaque()) + } func throwError(_ error: any Error) { report(String(describing: error), String(reflecting: type(of: error))) } @@ -433,6 +715,116 @@ private struct __NSCall { } } +// Carries values into a Task; the runtime only touches them on one thread at +// a time. +private final class __NSUnchecked: @unchecked Sendable { + let value: Value + init(_ value: Value) { self.value = value } +} + +// Settles an async call's Promise from any thread; the first report consumes +// the token. +private struct __NSCompletion: @unchecked Sendable, __NSReporter { + let api: UnsafeRawPointer + let token: UnsafeMutableRawPointer + + private func slot(_ index: Int, _: Function.Type) -> Function { + api.load(fromByteOffset: index * 8, as: Function.self) + } + + func returnVoid() { + slot(14, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(token) + } + func returnBool(_ value: Bool) { + slot(15, (@convention(c) (UnsafeMutableRawPointer, UInt8) -> Void).self)(token, value ? 1 : 0) + } + func returnInt64(_ value: Int64) { + slot(16, (@convention(c) (UnsafeMutableRawPointer, Int64) -> Void).self)(token, value) + } + func returnUInt64(_ value: UInt64) { + slot(17, (@convention(c) (UnsafeMutableRawPointer, UInt64) -> Void).self)(token, value) + } + func returnDouble(_ value: Double) { + slot(18, (@convention(c) (UnsafeMutableRawPointer, Double) -> Void).self)(token, value) + } + func returnString(_ value: String) { + var value = value + value.withUTF8 { + slot(19, (@convention(c) (UnsafeMutableRawPointer, UnsafePointer?, Int) -> Void).self)( + token, $0.baseAddress, $0.count) + } + } + func returnNull() { + slot(20, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(token) + } + func returnBytes(_ value: Data) { + value.withUnsafeBytes { + slot(19, (@convention(c) (UnsafeMutableRawPointer, UnsafePointer?, Int) -> Void).self)( + token, $0.bindMemory(to: UInt8.self).baseAddress, $0.count) + } + } + func returnArray(_ values: Elements, _ each: (Elements.Element) -> Void) { + slot(27, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(token, values.count) + for value in values { each(value) } + slot(28, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(token) + } + func returnMap(_ values: [String: Value], _ each: (String, Value) -> Void) { + slot(29, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(token, values.count) + for (key, value) in values { each(key, value) } + slot(30, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(token) + } + func returnCase(_ index: Int, _ values: () -> Void) { + slot(35, (@convention(c) (UnsafeMutableRawPointer, Int) -> Void).self)(token, index) + values() + slot(37, (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(token) + } + func returnObject(_ object: AnyObject, _ typeIndex: UInt32) { + slot(21, (@convention(c) (UnsafeMutableRawPointer, UnsafeMutableRawPointer, UInt32) -> Void).self)( + token, Unmanaged.passRetained(object).toOpaque(), typeIndex) + } + func returnObjC(_ object: AnyObject) { + slot(41, (@convention(c) (UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> Void).self)( + token, Unmanaged.passRetained(object).toOpaque()) + } + func throwError(_ error: any Error) { + var message = String(describing: error) + var type = String(reflecting: Swift.type(of: error)) + message.withUTF8 { messageBytes in + type.withUTF8 { typeBytes in + slot(22, (@convention(c) (UnsafeMutableRawPointer, UnsafePointer?, Int, + UnsafePointer?, Int) -> Void).self)( + token, messageBytes.baseAddress, messageBytes.count, typeBytes.baseAddress, typeBytes.count) + } + } + } +} + +// A JS function held as a Swift closure. Calls may come from any thread; the +// runtime runs the function on its isolate's thread. +private final class __NSCallback: @unchecked Sendable { + let api: UnsafeRawPointer + let handle: UnsafeMutableRawPointer + + init(api: UnsafeRawPointer, handle: UnsafeMutableRawPointer) { + self.api = api + self.handle = handle + api.load(fromByteOffset: 32 * 8, as: (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(handle) + } + + deinit { + api.load(fromByteOffset: 33 * 8, as: (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(handle) + } + + // `arguments` reports each argument through the ordinary return entries. + func invoke(_ arguments: (__NSCompletion) -> Void) { + let begin = api.load(fromByteOffset: 31 * 8, + as: (@convention(c) (UnsafeMutableRawPointer) -> UnsafeMutableRawPointer).self) + let completion = __NSCompletion(api: api, token: begin(handle)) + arguments(completion) + api.load(fromByteOffset: 28 * 8, as: (@convention(c) (UnsafeMutableRawPointer) -> Void).self)(completion.token) + } +} + private func __nsRelease(_ object: UnsafeMutableRawPointer) { Unmanaged.fromOpaque(object).release() } @@ -444,6 +836,10 @@ private func __nsRelease(_ object: UnsafeMutableRawPointer) { std::string out; for (const auto& type : _surface.types) { const Symbol& symbol = *type.symbol; + if (type.kind == SwiftSurface::kTaggedEnum) { + out += taggedEnumHelpers(type); + continue; + } if (symbol.kind != SymbolKind::Enum) { continue; } @@ -452,32 +848,177 @@ private func __nsRelease(_ object: UnsafeMutableRawPointer) { std::string attribute = availability.empty() ? "" : "@available(" + availability + ")\n"; std::string index = std::to_string(type.index); - std::vector cases; + // Cases newer than their enum are reached under #available. + struct Case { + std::string name; + std::string availability; + }; + std::vector cases; + bool anyGated = false; for (const auto& id : symbol.memberIds) { const Symbol* member = _module.find(id); - if (member && member->kind == SymbolKind::EnumCase) { - cases.push_back(member->baseName); + const Capability* capability = _classification.find(id); + if (!member || member->kind != SymbolKind::EnumCase || !capability || + capability->tier != Tier::SwiftGenerated) { + continue; } + std::string condition = availabilityCondition(_module, *member); + if (condition == availability) { + condition.clear(); + } + anyGated |= !condition.empty(); + cases.push_back(Case{member->baseName, condition}); } + + out += "// " + symbol.preciseId + "\n"; out += attribute + "private func __nsEnum" + index + "(_ name: String) -> " + typeName + "? {\n switch name {\n"; - for (const auto& name : cases) { + for (const auto& entry : cases) { // Qualified: a case named `none` would otherwise mean Optional.none. - out += " case " + quoted(name) + ": return " + typeName + "." + - swiftIdentifier(name) + "\n"; + std::string value = typeName + "." + swiftIdentifier(entry.name); + out += " case " + quoted(entry.name) + ": "; + out += entry.availability.empty() + ? "return " + value + "\n" + : "if #available(" + entry.availability + ") { return " + + value + " } else { return nil }\n"; } out += " default: return nil\n }\n}\n\n"; + out += attribute + "private func __nsEnumName" + index + "(_ value: " + typeName + ") -> String {\n switch value {\n"; - for (const auto& name : cases) { - out += " case " + typeName + "." + swiftIdentifier(name) + - ": return " + quoted(name) + "\n"; + for (const auto& entry : cases) { + if (entry.availability.empty()) { + out += " case " + typeName + "." + swiftIdentifier(entry.name) + + ": return " + quoted(entry.name) + "\n"; + } + } + if (anyGated) { + // A case pattern cannot be guarded by #available. + out += " default:\n"; + for (const auto& entry : cases) { + if (!entry.availability.empty()) { + out += " if #available(" + entry.availability + + "), value == " + typeName + "." + + swiftIdentifier(entry.name) + " { return " + + quoted(entry.name) + " }\n"; + } + } + out += " return String(describing: value)\n }\n}\n\n"; + } else { + out += + " @unknown default: return String(describing: value)\n }\n}\n\n"; } - out += " @unknown default: return String(describing: value)\n }\n}\n\n"; } return out; } + // __nsReadCase builds the enum from a case slot (NSSwiftTagCase: the + // case index, then its associated values) and __nsReportCase reports + // one, both by the case's registration index. + std::string taggedEnumHelpers(const SwiftSurface::Type& type) const { + const Symbol& symbol = *type.symbol; + std::string typeName = qualifiedTypeName(_module, symbol); + std::string availability = availabilityCondition(_module, symbol); + std::string attribute = + availability.empty() ? "" : "@available(" + availability + ")\n"; + std::string index = std::to_string(type.index); + std::vector cases = + _surface.casesOf(type.index); + + std::string read = "// " + symbol.preciseId + "\n" + attribute + + "private func __nsReadCase" + index + + "(_ slots: __NSSlots, _ i: Int) -> " + typeName + + "? {\n let (s, _) = slots.elements(i)\n" + " switch s.int64(0) {\n"; + std::string report = attribute + "private func __nsReportCase" + index + + "(_ r: R, _ value: " + typeName + + ") {\n switch value {\n"; + std::string gatedReports; + for (size_t k = 0; k < cases.size(); k++) { + const Symbol& member = *cases[k]->symbol; + const auto& elements = cases[k]->capability->parameters; + std::string condition = availabilityCondition(_module, member); + if (condition == availability) { + condition.clear(); + } + std::string value = typeName + "." + swiftIdentifier(member.baseName); + + read += " case " + std::to_string(k) + ":\n"; + if (!condition.empty()) { + read += " guard #available(" + condition + ") else { return nil }\n"; + } + std::vector arguments; + std::vector bindings; + std::vector reports; + for (size_t e = 0; e < elements.size(); e++) { + std::string name = "e" + std::to_string(e); + read += readCaseElement(elements[e], e + 1, name); + const std::string& label = + e < member.parameters.size() ? member.parameters[e].label : ""; + arguments.push_back(label.empty() ? name : label + ": " + name); + std::string bound = "p" + std::to_string(e); + bindings.push_back(bound); + std::string statement = returnValue(elements[e], "r", bound); + reports.push_back(elements[e].optional + ? "if let " + bound + " { " + statement + + " } else { r.returnNull() }" + : statement); + } + read += + " return " + value + + (arguments.empty() ? "" : "(" + llvm::join(arguments, ", ") + ")") + + "\n"; + + std::string pattern = + value + + (bindings.empty() ? "" : "(" + llvm::join(bindings, ", ") + ")"); + std::string body = "r.returnCase(" + std::to_string(k) + ") { " + + llvm::join(reports, "; ") + " }"; + if (condition.empty()) { + report += " case " + std::string(bindings.empty() ? "" : "let ") + + pattern + ": " + body + "\n"; + } else { + // A case pattern cannot be guarded by #available. + gatedReports += " if #available(" + condition + "), case " + + (bindings.empty() ? "" : "let ") + pattern + + " = value { " + body + "; return }\n"; + } + } + read += " default: return nil\n }\n}\n\n"; + size_t declared = 0; + for (const auto& id : symbol.memberIds) { + const Symbol* member = _module.find(id); + declared += member && member->kind == SymbolKind::EnumCase; + } + // Cases JS never sees (unavailable ones) report null. + report += gatedReports.empty() && declared == cases.size() + ? " @unknown default: r.returnNull()\n" + : " default:\n" + gatedReports + " r.returnNull()\n"; + report += " }\n}\n\n"; + return read + report; + } + + // Lines binding `name` to associated value slot `slot` of `s`, returning + // nil when it does not convert. + std::string readCaseElement(const BridgedType& type, size_t slot, + const std::string& name) const { + std::string index = std::to_string(slot); + ValueExpression value = valueExpression(type, "s", index); + std::string typeText = valueTypeName(type); + if (!type.optional) { + return value.failable ? " guard let " + name + " = " + value.code + + " else { return nil }\n" + : " let " + name + " = " + value.code + "\n"; + } + if (!value.failable) { + return " let " + name + ": " + typeText + "? = s.isNull(" + index + + ") ? nil : " + value.code + "\n"; + } + return " var " + name + ": " + typeText + "? = nil\n if !s.isNull(" + + index + ") {\n guard let value = " + value.code + + " else { return nil }\n " + name + " = value\n }\n"; + } + // Dynamic type index of a returned object: most derived classes first. std::string typeIndexFunction() const { std::vector classes; @@ -556,7 +1097,8 @@ private func __nsRelease(_ object: UnsafeMutableRawPointer) { const Symbol& symbol = *type.symbol; int kind = type.kind; out += " registerType(registrar, " + std::to_string(type.index) + ", " + - std::to_string(kind) + ", " + quoted(symbol.name) + ", " + + std::to_string(kind) + ", " + + quoted(llvm::join(symbol.pathComponents, ".")) + ", " + quoted(qualifiedTypeName(_module, symbol)) + ", " + std::to_string(type.superIndex) + ")\n"; } diff --git a/metadata-generator/src/Swift/ThunkEmitter.h b/metadata-generator/src/Swift/ThunkEmitter.h index 0657601e..b858d1dc 100644 --- a/metadata-generator/src/Swift/ThunkEmitter.h +++ b/metadata-generator/src/Swift/ThunkEmitter.h @@ -9,7 +9,7 @@ namespace Swift { // ABI version the emitted thunks implement; must match NS_SWIFT_ABI_VERSION // in NativeScript/runtime/SwiftInterop.h, which documents the contract. -constexpr int kThunkABIVersion = 1; +constexpr int kThunkABIVersion = 7; struct ThunkSource { std::string source; diff --git a/metadata-generator/src/TypeScript/SwiftDefinitionWriter.cpp b/metadata-generator/src/TypeScript/SwiftDefinitionWriter.cpp index bb2667f8..216a7508 100644 --- a/metadata-generator/src/TypeScript/SwiftDefinitionWriter.cpp +++ b/metadata-generator/src/TypeScript/SwiftDefinitionWriter.cpp @@ -95,16 +95,43 @@ std::string codeDisplayName(const SwiftSurface& surface, break; case Bridge::ClassHandle: case Bridge::StructBox: - case Bridge::EnumCase: { + case Bridge::EnumCase: + case Bridge::TaggedEnum: { int index = surface.indexOf(type.symbolId); name = index >= 0 ? surface.types[index].symbol->name : "?"; break; } + case Bridge::Date: + name = "Date"; + break; + case Bridge::URL: + name = "URL"; + break; + case Bridge::Data: + name = "Data"; + break; + case Bridge::Array: + name = "[" + codeDisplayName(surface, type.elements.at(0)) + "]"; + break; + case Bridge::Dictionary: + name = "[String: " + codeDisplayName(surface, type.elements.at(0)) + "]"; + break; + case Bridge::Closure: { + std::vector parameters; + for (const auto& element : type.elements) { + parameters.push_back(codeDisplayName(surface, element)); + } + name = "(" + llvm::join(parameters, ", ") + ") -> Void"; + break; + } + case Bridge::ObjCObject: + name = type.objcClass; + break; case Bridge::None: name = "?"; break; } - return type.optional ? name + "?" : name; + return (type.isInout ? "inout " : "") + (type.optional ? name + "?" : name); } std::string typedKey(const SwiftSurface& surface, const Member& member) { @@ -136,12 +163,9 @@ class Writer { << ": every declaration is backed by a generated thunk.\n\n" << "declare module \"ns:swift/" << _module.name << "\" {\n"; - for (const auto& type : _surface.types) { - if (type.kind == SwiftSurface::kEnum) { - writeEnum(type); - } else { - writeClass(type); - } + buildTree(); + for (const auto& path : _topLevel) { + writeNode(_nodes.at(path), " "); } writeModuleMembers(); @@ -211,6 +235,14 @@ class Writer { // Whether some JS value is accepted as both `a` and `b` (overload // resolution in the runtime would then see both). bool overlaps(const BridgedType& a, const BridgedType& b) const { + if (a.isInout || b.isInout) { + // A reference object is a record. + auto record = [](const BridgedType& type) { + return type.isInout || type.bridge == Bridge::Dictionary || + type.bridge == Bridge::TaggedEnum; + }; + return record(a) && record(b); + } if (a.optional && b.optional) { return true; } @@ -218,8 +250,20 @@ class Writer { return bridge == Bridge::Integer || bridge == Bridge::Floating; }; auto textual = [](Bridge bridge) { - return bridge == Bridge::String || bridge == Bridge::EnumCase; + return bridge == Bridge::String || bridge == Bridge::EnumCase || + bridge == Bridge::URL; }; + auto record = [](Bridge bridge) { + return bridge == Bridge::Dictionary || bridge == Bridge::TaggedEnum; + }; + if (a.bridge == b.bridge && + (a.bridge == Bridge::Date || a.bridge == Bridge::Data || + a.bridge == Bridge::Array || a.bridge == Bridge::Closure)) { + return true; + } + if (record(a.bridge) && record(b.bridge)) { + return true; + } if (numeric(a.bridge) && numeric(b.bridge)) { return true; } @@ -281,10 +325,23 @@ class Writer { std::string typeName(const BridgedType& type) const { int index = _surface.indexOf(type.symbolId); - return index >= 0 ? _surface.types[index].symbol->name : "unknown"; + return index >= 0 + ? llvm::join(_surface.types[index].symbol->pathComponents, ".") + : "unknown"; + } + + // NativeScript's Objective-C typings declare classes globally by their + // runtime name; Swift classes without @objc(Name) have none there. + static std::string objcTypeName(const BridgedType& type) { + return isIdentifier(type.objcClass) ? type.objcClass : "NSObject"; } std::string inputType(const BridgedType& type) const { + if (type.isInout) { + BridgedType value = type; + value.isInout = false; + return "{ value: " + inputType(value) + " }"; + } std::string ts; switch (type.bridge) { case Bridge::Bool: @@ -302,13 +359,42 @@ class Writer { case Bridge::ClassHandle: case Bridge::StructBox: case Bridge::EnumCase: + case Bridge::TaggedEnum: ts = typeName(type); break; + case Bridge::ObjCObject: + ts = objcTypeName(type); + break; + case Bridge::Date: + ts = "Date"; + break; + case Bridge::URL: + ts = "string | URL"; + break; + case Bridge::Data: + ts = "ArrayBuffer | ArrayBufferView"; + break; + case Bridge::Array: + ts = "readonly (" + inputType(type.elements.at(0)) + ")[]"; + break; + case Bridge::Dictionary: + ts = "Readonly>"; + break; + case Bridge::Closure: { + // The function receives what Swift passes: output types. + std::vector parameters; + for (size_t i = 0; i < type.elements.size(); i++) { + parameters.push_back("arg" + std::to_string(i) + ": " + + outputType(type.elements[i])); + } + ts = "(" + llvm::join(parameters, ", ") + ") => void"; + break; + } default: ts = "never"; break; } - return type.optional ? ts + " | null | undefined" : ts; + return type.optional ? "(" + ts + ") | null | undefined" : ts; } std::string outputType(const BridgedType& type) const { @@ -329,8 +415,30 @@ class Writer { case Bridge::ClassHandle: case Bridge::StructBox: case Bridge::EnumCase: + case Bridge::TaggedEnum: ts = typeName(type); break; + case Bridge::ObjCObject: + ts = objcTypeName(type); + break; + case Bridge::Date: + ts = "Date"; + break; + case Bridge::URL: + ts = "URL"; + break; + case Bridge::Data: + ts = "Uint8Array"; + break; + case Bridge::Array: + ts = "(" + outputType(type.elements.at(0)) + ")[]"; + break; + case Bridge::Dictionary: + ts = "Record"; + break; + case Bridge::Closure: + ts = "never"; + break; case Bridge::None: ts = "never"; break; @@ -338,6 +446,13 @@ class Writer { return type.optional ? ts + " | null" : ts; } + // A member's JS result: a Promise for async calls. + std::string resultOf(const Member& member) const { + std::string type = outputType(member.result); + return (member.flags & SwiftSurface::kAsync) ? "Promise<" + type + ">" + : type; + } + std::string parameterList(const Member& member, const std::string& receiver = "") const { std::vector parts; @@ -426,23 +541,68 @@ class Writer { } writeDoc(*member->symbol, indent); _out << indent << prefix << propertyKey(group.jsName) << "(" - << parameterList(*member, receiver) - << "): " << outputType(member->result) << ";\n"; + << parameterList(*member, receiver) << "): " << resultOf(*member) + << ";\n"; } for (const auto& key : overloadKeys(group)) { writeDoc(*key.second->symbol, indent); _out << indent << prefix << propertyKey(key.first) << "(" << parameterList(*key.second, receiver) - << "): " << outputType(key.second->result) << ";\n"; + << "): " << resultOf(*key.second) << ";\n"; + } + } + + // A type, or a namespace standing in for an unbridged parent, by JS path. + struct Node { + std::string name; + const SwiftSurface::Type* type = nullptr; + std::vector children; + }; + + void buildTree() { + for (const auto& type : _surface.types) { + const auto& components = type.symbol->pathComponents; + std::string path; + for (size_t i = 0; i < components.size(); i++) { + std::string parent = path; + path += (i > 0 ? "." : "") + components[i]; + auto inserted = _nodes.emplace(path, Node{components[i], nullptr, {}}); + if (inserted.second) { + (parent.empty() ? _topLevel : _nodes.at(parent).children) + .push_back(path); + } + } + _nodes.at(path).type = &type; + } + } + + void writeNode(const Node& node, const std::string& indent) { + if (node.type && (node.type->kind == SwiftSurface::kEnum || + node.type->kind == SwiftSurface::kTaggedEnum)) { + writeEnum(*node.type, node, indent); + return; + } + if (node.type) { + writeClass(*node.type, indent); + } + if (!node.children.empty()) { + _out << indent << "export namespace " << node.name << " {\n"; + for (const auto& child : node.children) { + writeNode(_nodes.at(child), indent + " "); + } + _out << indent << "}\n\n"; } } - void writeClass(const SwiftSurface::Type& type) { + void writeClass(const SwiftSurface::Type& type, const std::string& indent) { const Symbol& symbol = *type.symbol; - writeDoc(symbol, " "); - _out << " export class " << symbol.name; + std::string inner = indent + " "; + writeDoc(symbol, indent); + _out << indent << "export class " << symbol.name; if (type.superIndex >= 0) { - _out << " extends " << _surface.types[type.superIndex].symbol->name; + _out << " extends " + << llvm::join(_surface.types[type.superIndex].symbol->pathComponents, + "."); } _out << " {\n"; @@ -454,16 +614,16 @@ class Writer { } hasInitializer = true; for (const Member* member : group.overloads) { - writeDoc(*member->symbol, " "); - _out << " constructor(" << parameterList(*member) << ");\n"; + writeDoc(*member->symbol, inner); + _out << inner << "constructor(" << parameterList(*member) << ");\n"; std::string labeled = labeledParameters(*member); if (!labeled.empty()) { - _out << " constructor(args: " << labeled << ");\n"; + _out << inner << "constructor(args: " << labeled << ");\n"; } } } if (!hasInitializer) { - _out << " private constructor();\n"; + _out << inner << "private constructor();\n"; } for (const Group& group : _groups) { @@ -474,82 +634,118 @@ class Writer { switch (group.kind) { case SwiftSurface::kInstanceProperty: case SwiftSurface::kStaticProperty: - writeDoc(*first.symbol, " "); - _out << " " + writeDoc(*first.symbol, inner); + _out << inner << (group.kind == SwiftSurface::kStaticProperty ? "static " : "") << ((first.flags & SwiftSurface::kSettable) ? "" : "readonly ") - << propertyKey(group.jsName) << ": " << outputType(first.result) - << ";\n"; + << propertyKey(group.jsName) << ": " << resultOf(first) << ";\n"; break; case SwiftSurface::kInstanceMethod: - writeMethodGroup(group, " ", ""); + writeMethodGroup(group, inner, ""); break; case SwiftSurface::kStaticMethod: - writeMethodGroup(group, " ", "static "); + writeMethodGroup(group, inner, "static "); break; default: break; } } - _out << " }\n\n"; + _out << indent << "}\n\n"; } - void writeEnum(const SwiftSurface::Type& type) { + // `type` (a union of case names, or of case objects when cases carry + // values) plus a namespace of the enum object's members, which can also + // hold nested types; TypeScript cannot merge a namespace with a const. + void writeEnum(const SwiftSurface::Type& type, const Node& node, + const std::string& indent) { const Symbol& symbol = *type.symbol; + std::string self = llvm::join(symbol.pathComponents, "."); + std::string inner = indent + " "; + bool tagged = type.kind == SwiftSurface::kTaggedEnum; std::vector cases; - for (const Group& group : _groups) { - if (group.owner == type.index && group.kind == SwiftSurface::kEnumCase) { - cases.push_back("\"" + group.jsName + "\""); + for (const Member* member : _surface.casesOf(type.index)) { + const std::string& name = member->capability->jsName; + if (!tagged) { + cases.push_back("\"" + name + "\""); + continue; + } + std::string shape = "{ case: \"" + name + "\""; + std::vector keys = caseKeys(*member->symbol); + const auto& elements = member->capability->parameters; + for (size_t i = 0; i < elements.size() && i < keys.size(); i++) { + shape += "; " + propertyKey(keys[i]) + ": " + outputType(elements[i]); } + cases.push_back(shape + " }"); + } + writeDoc(symbol, indent); + _out << indent << "export type " << symbol.name << " ="; + if (cases.empty()) { + _out << " never"; + } else if (tagged) { + for (const auto& shape : cases) { + _out << "\n" << inner << "| " << shape; + } + } else { + _out << " " << llvm::join(cases, " | "); } - writeDoc(symbol, " "); - _out << " export type " << symbol.name << " = " - << (cases.empty() ? std::string("never") : llvm::join(cases, " | ")) - << ";\n"; - _out << " export const " << symbol.name << ": {\n"; + _out << ";\n"; + _out << indent << "export namespace " << symbol.name << " {\n"; for (const Group& group : _groups) { - if (group.owner != type.index) { + if (group.owner != type.index || !isIdentifier(group.jsName) || + isReserved(group.jsName)) { continue; } const Member& first = *group.overloads[0]; switch (group.kind) { case SwiftSurface::kEnumCase: - _out << " readonly " << propertyKey(group.jsName) << ": \"" - << group.jsName << "\";\n"; + if (!tagged) { + _out << inner << "export const " << group.jsName << ": \"" + << group.jsName << "\";\n"; + } break; case SwiftSurface::kInitializer: - // Enum initializers are exposed as `init`; they produce a case name. + // Enum initializers are exposed as `init`: `new` cannot produce a + // case. for (const Member* member : group.overloads) { - writeDoc(*member->symbol, " "); - _out << " init(" << parameterList(*member) - << "): " << outputType(member->result) << ";\n"; + writeDoc(*member->symbol, inner); + _out << inner << "export function init(" << parameterList(*member) + << "): " << resultOf(*member) << ";\n"; } break; case SwiftSurface::kStaticProperty: - writeDoc(*first.symbol, " "); - _out << " " - << ((first.flags & SwiftSurface::kSettable) ? "" : "readonly ") - << propertyKey(group.jsName) << ": " << outputType(first.result) - << ";\n"; + writeDoc(*first.symbol, inner); + _out << inner << "export " + << ((first.flags & SwiftSurface::kSettable) ? "let " : "const ") + << group.jsName << ": " << resultOf(first) << ";\n"; break; case SwiftSurface::kInstanceProperty: - // A case name has no properties; instance members take it first. - writeDoc(*first.symbol, " "); - _out << " " << propertyKey(group.jsName) - << "(value: " << symbol.name << "): " << outputType(first.result) - << ";\n"; + // A case value has no members; instance members take it first. + writeDoc(*first.symbol, inner); + _out << inner << "export function " << group.jsName + << "(value: " << self << "): " << resultOf(first) << ";\n"; break; case SwiftSurface::kInstanceMethod: - writeMethodGroup(group, " ", "", symbol.name); - break; case SwiftSurface::kStaticMethod: - writeMethodGroup(group, " ", ""); + for (const Member* member : group.overloads) { + if (ambiguousWithin(group, *member)) { + continue; + } + writeDoc(*member->symbol, inner); + _out << inner << "export function " << group.jsName << "(" + << parameterList( + *member, + group.kind == SwiftSurface::kInstanceMethod ? self : "") + << "): " << resultOf(*member) << ";\n"; + } break; default: break; } } - _out << " };\n\n"; + for (const auto& child : node.children) { + writeNode(_nodes.at(child), inner); + } + _out << indent << "}\n\n"; } void writeModuleMembers() { @@ -565,7 +761,7 @@ class Writer { writeDoc(*first.symbol, " "); _out << " export " << ((first.flags & SwiftSurface::kSettable) ? "let " : "const ") - << group.jsName << ": " << outputType(first.result) << ";\n"; + << group.jsName << ": " << resultOf(first) << ";\n"; continue; } for (const Member* member : group.overloads) { @@ -574,8 +770,7 @@ class Writer { } writeDoc(*member->symbol, " "); _out << " export function " << group.jsName << "(" - << parameterList(*member) << "): " << outputType(member->result) - << ";\n"; + << parameterList(*member) << "): " << resultOf(*member) << ";\n"; } } } @@ -583,6 +778,8 @@ class Writer { const Module& _module; SwiftSurface _surface; std::vector _groups; + std::map _nodes; + std::vector _topLevel; std::ostringstream _out; }; diff --git a/metadata-generator/tests/swift/ClassifierTests.cpp b/metadata-generator/tests/swift/ClassifierTests.cpp index 4e915ead..cf062e47 100644 --- a/metadata-generator/tests/swift/ClassifierTests.cpp +++ b/metadata-generator/tests/swift/ClassifierTests.cpp @@ -52,9 +52,16 @@ TEST(ClassifyNominalTypes) { EXPECT_TIER("Counter", Tier::SwiftGenerated); EXPECT_TIER("Canvas", Tier::SwiftGenerated); EXPECT_TIER("Greeter", Tier::TypeOnly, "protocol"); - EXPECT_TIER("Measurement", Tier::Unsupported, "enum-associated-values"); - EXPECT_TIER("ShapeError", Tier::Unsupported, "enum-associated-values"); - EXPECT_TIER("Measurement.Unit", Tier::Unsupported, "nested-type"); + EXPECT_TIER("Measurement", Tier::SwiftGenerated); + EXPECT_TIER("ShapeError", Tier::SwiftGenerated); + EXPECT_TIER("Formula", Tier::SwiftGenerated); + EXPECT_TIER("Payload", Tier::SwiftGenerated); + EXPECT_TIER("Job", Tier::Unsupported, "enum-associated-values,closure"); + EXPECT_TIER("Measurement.Unit", Tier::SwiftGenerated); + EXPECT_TIER("Polygon.Style", Tier::SwiftGenerated); + EXPECT_TIER("Polygon.Metrics", Tier::SwiftGenerated); + EXPECT_TIER("Polygon.Metrics.init(perimeter:)", Tier::SwiftGenerated); + EXPECT_TIER("Polygon.style", Tier::SwiftGenerated); EXPECT_TIER("Coordinates", Tier::TypeOnly, "type-alias"); } @@ -74,8 +81,7 @@ TEST(ClassifyCallables) { EXPECT_TIER("Polygon.make()", Tier::SwiftGenerated); EXPECT_TIER("Polygon.shared", Tier::SwiftGenerated); EXPECT_TIER("Ring.expand(by:)", Tier::SwiftGenerated); - EXPECT_TIER("Loader.load(path:)", Tier::Unsupported, - "unbridged-type:Foundation.Data"); + EXPECT_TIER("Loader.load(path:)", Tier::SwiftGenerated); EXPECT_TIER("Loader.modernOnly()", Tier::SwiftGenerated); EXPECT_TIER("Loader.legacyFetch()", Tier::SwiftGenerated); EXPECT_TIER("makeDefaultPoint()", Tier::SwiftGenerated); @@ -87,23 +93,75 @@ TEST(ClassifyCallables) { TEST(ClassifyRejections) { EXPECT_TIER("Greeter.greet(name:)", Tier::TypeOnly, "protocol-requirement"); - EXPECT_TIER("Loader.fetch(url:)", Tier::Unsupported, "async"); - EXPECT_TIER("Loader.wait(seconds:)", Tier::Unsupported, "async"); + EXPECT_TIER("Loader.fetch(url:)", Tier::SwiftGenerated); EXPECT_TIER("Loader.transform(_:)", Tier::SwiftSpecialized, "generic"); EXPECT_TIER("Loader.first(of:)", Tier::SwiftSpecialized, "generic"); - EXPECT_TIER("Loader.withCompletion(_:)", Tier::Unsupported, "closure"); - EXPECT_TIER("Loader.each(_:)", Tier::Unsupported, "closure"); - EXPECT_TIER("Loader.update(_:)", Tier::Unsupported, "inout-parameter"); - EXPECT_TIER("Loader.lookup(table:key:)", Tier::Unsupported, "collection"); - EXPECT_TIER("Counter.increment()", Tier::Unsupported, "actor-isolated"); - EXPECT_TIER("Counter.value", Tier::Unsupported, "actor-isolated"); - EXPECT_TIER("Canvas.init()", Tier::Unsupported, "main-actor"); - EXPECT_TIER("Canvas.draw(_:)", Tier::Unsupported, "main-actor"); + EXPECT_TIER("Loader.withCompletion(_:)", Tier::Unsupported, "unbridged-type:Swift.Result"); + EXPECT_TIER("Loader.each(_:)", Tier::SwiftGenerated); + EXPECT_TIER("countdown(from:_:)", Tier::SwiftGenerated); + EXPECT_TIER("greetLater(_:completion:)", Tier::SwiftGenerated); + EXPECT_TIER("Notifier.subscribe(_:)", Tier::SwiftGenerated); + EXPECT_TIER("Loader.update(_:)", Tier::SwiftGenerated); + EXPECT_TIER("tags(_:)", Tier::SwiftGenerated); + EXPECT_TIER("Note", Tier::ObjCDirect, "objc-visible"); + EXPECT_TIER("halve(_:)", Tier::SwiftGenerated); + EXPECT_TIER("Loader.lookup(table:key:)", Tier::SwiftGenerated); + EXPECT_TIER("Canvas.draw(_:)", Tier::Unsupported, "existential"); EXPECT_TIER("Ring.+(_:_:)", Tier::Unsupported, "operator"); EXPECT_TIER("Polygon.subscript(_:)", Tier::Unsupported, "subscript"); EXPECT_TIER("String.shouted", Tier::Unsupported, "external-type-extension"); - EXPECT_TIER("Measurement.isNone", Tier::Unsupported, "owner-not-bridged"); - EXPECT_TIER("Flavor.hash(into:)", Tier::Unsupported, "inout-parameter"); + EXPECT_TIER("Measurement.isNone", Tier::SwiftGenerated); + EXPECT_TIER("Job.idle", Tier::Unsupported, "owner-not-bridged"); + EXPECT_TIER("Flavor.hash(into:)", Tier::Unsupported, "unbridged-type:Swift.Hasher"); +} + +TEST(ClassifyIsolationAndAsync) { + auto flags = [](const std::string& path) { + const Capability* capability = capabilityAt(path); + if (!capability || capability->tier != Tier::SwiftGenerated) { + return std::string("not generated"); + } + return std::string(capability->isAsync ? "async" : "sync") + + (capability->isMainActor ? ",main" : "") + + (capability->isSettable ? ",settable" : ""); + }; + CHECK_EQ(flags("Loader.wait(seconds:)"), std::string("async")); + CHECK_EQ(flags("delayedEcho(_:after:)"), std::string("async")); + CHECK_EQ(flags("makeTrackerLater(id:)"), std::string("async")); + // Actor members are awaited from outside, and never assignable. + CHECK_EQ(flags("Counter.increment()"), std::string("async")); + CHECK_EQ(flags("Counter.value"), std::string("async")); + CHECK_EQ(flags("Counter.step"), std::string("async")); + CHECK_EQ(flags("Counter.label()"), std::string("sync")); + CHECK_EQ(flags("Counter.init()"), std::string("sync")); + // Main-actor members run on the main thread; async ones hop there. + CHECK_EQ(flags("Palette.init()"), std::string("sync,main")); + CHECK_EQ(flags("Palette.stroke()"), std::string("sync,main")); + CHECK_EQ(flags("Palette.strokes"), std::string("sync,main")); + CHECK_EQ(flags("Palette.strokeLater()"), std::string("async,main")); + CHECK_EQ(flags("Canvas.init()"), std::string("sync,main")); +} + +TEST(ClassifyCollectionsAndFoundation) { + const Capability* grid = capabilityAt("mirrored(_:)"); + REQUIRE(grid && grid->tier == Tier::SwiftGenerated); + CHECK(grid->result.bridge == Bridge::Array); + REQUIRE(grid->result.elements.size() == 1); + CHECK(grid->result.elements[0].bridge == Bridge::Array); + CHECK(grid->result.elements[0].elements.at(0).bridge == Bridge::Integer); + + const Capability* counts = capabilityAt("wordCounts(_:)"); + REQUIRE(counts && counts->tier == Tier::SwiftGenerated); + CHECK(counts->result.bridge == Bridge::Dictionary); + + CHECK(capabilityAt("nextDay(after:)")->result.bridge == Bridge::Date); + CHECK(capabilityAt("resolve(_:against:)")->parameters[1].bridge == + Bridge::URL); + CHECK(capabilityAt("ramp(_:)")->result.bridge == Bridge::Data); + CHECK(capabilityAt("trackers(_:)")->result.elements.at(0).bridge == + Bridge::ClassHandle); + CHECK(capabilityAt("allFlavors()")->result.elements.at(0).bridge == + Bridge::EnumCase); } TEST(ClassifyBridges) { @@ -183,6 +241,36 @@ TEST(VerifierParsesDiagnostics) { CHECK_EQ(unmapped[0], std::string("99: outside probes")); } +TEST(VerifierAttributesThunkErrors) { + const std::string greet = symbolAt(demo(), "Demo.greet(name:)")->preciseId; + const std::string flavor = symbolAt(demo(), "Flavor")->preciseId; + std::string source = + "import Foundation\n" // 1 + "// " + + greet + + "\n" // 2 + "private func thunk() {\n" // 3 + "}\n" // 4 + "// " + + greet + + " (setter)\n" // 5 + "// " + + flavor + + "\n" // 6 + "private func helper() {}\n"; // 7 + std::string log = + "/t.swift:3:1: error: in the thunk\n" + "/t.swift:7:1: error: in the enum helper\n" + "/t.swift:1:1: error: before any symbol\n"; + std::vector unmapped; + auto rejections = + rejectionsFromThunkLog(log, "/t.swift", source, demo(), unmapped); + CHECK_EQ(rejections.size(), size_t(2)); + CHECK_EQ(rejections[greet], std::string("in the thunk")); + CHECK_EQ(rejections[flavor], std::string("in the enum helper")); + CHECK_EQ(unmapped.size(), size_t(1)); +} + TEST(VerifierAcceptsFixture) { if (fixtureModuleDirectory().empty()) { std::cout << " (skipped: no Swift toolchain)" << std::endl; diff --git a/metadata-generator/tests/swift/SymbolGraphLoaderTests.cpp b/metadata-generator/tests/swift/SymbolGraphLoaderTests.cpp index 4c02843f..e262cf8f 100644 --- a/metadata-generator/tests/swift/SymbolGraphLoaderTests.cpp +++ b/metadata-generator/tests/swift/SymbolGraphLoaderTests.cpp @@ -74,15 +74,74 @@ TEST(TopLevelDeclarationsInSourceOrder) { for (const auto& id : demo().topLevelIds) { names.push_back(demo().find(id)->name); } - std::vector expected = { - "Greeter", "Demo", "Point", - "Flavor", "Shape", "Polygon", - "Square", "Precipitation", "ShapeError", - "Measurement", "Ring", "Counter", - "Canvas", "Loader", "makeDefaultPoint()", - "defaultFlavor", "globalCounter", "Coordinates", - "checkedSide(_:)", "echoInt8(_:)", "echoUInt64(_:)", - "largestInt()", "shout(_:)", "Tracker"}; + std::vector expected = {"Greeter", + "Demo", + "Point", + "Flavor", + "Shape", + "Polygon", + "Square", + "Precipitation", + "ShapeError", + "Measurement", + "Ring", + "Counter", + "Canvas", + "Loader", + "makeDefaultPoint()", + "defaultFlavor", + "globalCounter", + "Coordinates", + "checkedSide(_:)", + "echoInt8(_:)", + "echoUInt64(_:)", + "largestInt()", + "shout(_:)", + "Tracker", + "delayedEcho(_:after:)", + "makeTrackerLater(id:)", + "Palette", + "names(_:)", + "total(_:)", + "centroid(of:)", + "mirrored(_:)", + "wordCounts(_:)", + "lengths(_:)", + "trackers(_:)", + "allFlavors()", + "nextDay(after:)", + "host(of:)", + "resolve(_:against:)", + "checksum(_:)", + "ramp(_:)", + "namesLater(_:)", + "countdown(from:_:)", + "greetLater(_:completion:)", + "Notifier", + "area(of:)", + "measure(_:by:)", + "measurements()", + "measureLater(_:)", + "onMeasure(_:)", + "explain(_:)", + "Formula", + "simplify(_:)", + "Payload", + "echo(_:)", + "Job", + "bump(_:)", + "append(_:to:)", + "halve(_:)", + "clear(_:)", + "swapTrackers(_:_:)", + "describe(_:)", + "makeLabel(_:)", + "tags(_:)", + "firstSubview(of:)", + "Note", + "makeNote(_:)", + "text(of:)", + "noteLater(_:)"}; CHECK_EQ(llvm::join(names, ","), llvm::join(expected, ",")); } diff --git a/metadata-generator/tests/swift/ThunkEmitterTests.cpp b/metadata-generator/tests/swift/ThunkEmitterTests.cpp index 210e393a..bea82aaf 100644 --- a/metadata-generator/tests/swift/ThunkEmitterTests.cpp +++ b/metadata-generator/tests/swift/ThunkEmitterTests.cpp @@ -45,8 +45,22 @@ TEST(ThunkRegistration) { CHECK_EQ(thunks().registerSymbol, std::string("ns_swift_register_SwiftDemo")); CHECK_EQ(thunks().fingerprint.size(), size_t(16)); CHECK(thunks().thunkCount > 0); - CHECK(registers("registerModule(registrar, 1, \"SwiftDemo\", \"" + + CHECK(registers("registerModule(registrar, 7, \"SwiftDemo\", \"" + thunks().fingerprint + "\", __nsRelease)")); + // Cases of a tagged enum register their associated values' codes. + CHECK(registers("\"tooManySides\", \"tooManySides(count:limit:)\", \"i64,i64>t")); + CHECK(registers("\"area\", \"area(of:)\", \"t")); + // Objective-C classes travel by runtime name; their framework is imported. + CHECK(registers("\"firstSubview\", \"firstSubview(of:)\", \"@UIView>@UIView?\"")); + CHECK(registers("\"makeNote\", \"makeNote(_:)\", \"s>@SwiftDemo.Note\"")); + CHECK(thunks().source.find("#if canImport(UIKit)\nimport UIKit\n#endif") != std::string::npos); + // Inout parameters are marked; the thunk writes their final value back. + CHECK(registers("\"append\", \"append(_:to:)\", \"s,&[s]>v\"")); + CHECK(registers("\"swapTrackers\", \"swapTrackers(_:_:)\", \"&o")); + CHECK(thunks().source.find("rt.writeBack(1) { rt.returnArray(a1)") != std::string::npos); + // Closure parameters list the closure's own parameter codes. + CHECK(registers("\"countdown\", \"countdown(from:_:)\", \"i64,(i64,b)>v\"")); + CHECK(registers("\"greetLater\", \"greetLater(_:completion:)\", \"s?,(s?)>v\"")); // Instance method with labels; signature (String, Int) -> String. CHECK(registers("\"greet\", \"greet(name:times:)\", \"s,i64>s\"")); // Failable initializer of a class returns an optional object. @@ -108,6 +122,8 @@ TEST(TypeScriptUsageCompiles) { std::string usagePath = write("usage.ts", "/// \n" + "/// \n" "/// \n" + (*usage)->getBuffer().str()); diff --git a/metadata-generator/tests/swift/snapshots/SwiftDemo.coverage.json b/metadata-generator/tests/swift/snapshots/SwiftDemo.coverage.json index 114155fe..6880ebcb 100644 --- a/metadata-generator/tests/swift/snapshots/SwiftDemo.coverage.json +++ b/metadata-generator/tests/swift/snapshots/SwiftDemo.coverage.json @@ -2,24 +2,24 @@ "module": "SwiftDemo", "totals": { "declarations": { - "total": 113, - "objc-direct": 0, - "swift-generated": 68, + "total": 202, + "objc-direct": 1, + "swift-generated": 165, "swift-specialized": 5, "type-only": 6, - "unsupported": 34, + "unsupported": 25, "not-applicable": 0 }, "callable": { - "total": 96, + "total": 176, "objc-direct": 0, - "swift-generated": 57, + "swift-generated": 144, "swift-specialized": 5, "type-only": 3, - "unsupported": 31, + "unsupported": 24, "not-applicable": 0 }, - "effectiveCallable": 57, + "effectiveCallable": 144, "compilerVerified": false, "compiledThunks": null, "runtimeTested": null @@ -35,63 +35,63 @@ "not-applicable": 0 }, "class": { - "total": 6, - "objc-direct": 0, - "swift-generated": 6, + "total": 9, + "objc-direct": 1, + "swift-generated": 8, "swift-specialized": 0, "type-only": 0, "unsupported": 0, "not-applicable": 0 }, "enum": { - "total": 4, + "total": 8, "objc-direct": 0, - "swift-generated": 2, + "swift-generated": 7, "swift-specialized": 0, "type-only": 0, - "unsupported": 2, + "unsupported": 1, "not-applicable": 0 }, "enumCase": { - "total": 11, + "total": 23, "objc-direct": 0, - "swift-generated": 5, + "swift-generated": 21, "swift-specialized": 0, "type-only": 0, - "unsupported": 6, + "unsupported": 2, "not-applicable": 0 }, "function": { - "total": 6, + "total": 44, "objc-direct": 0, - "swift-generated": 6, + "swift-generated": 44, "swift-specialized": 0, "type-only": 0, "unsupported": 0, "not-applicable": 0 }, "initializer": { - "total": 13, + "total": 19, "objc-direct": 0, - "swift-generated": 11, + "swift-generated": 18, "swift-specialized": 0, "type-only": 0, - "unsupported": 2, + "unsupported": 1, "not-applicable": 0 }, "instanceMethod": { - "total": 33, + "total": 41, "objc-direct": 0, - "swift-generated": 13, + "swift-generated": 27, "swift-specialized": 5, "type-only": 1, - "unsupported": 14, + "unsupported": 8, "not-applicable": 0 }, "instanceProperty": { - "total": 20, + "total": 32, "objc-direct": 0, - "swift-generated": 14, + "swift-generated": 26, "swift-specialized": 0, "type-only": 1, "unsupported": 5, @@ -107,12 +107,12 @@ "not-applicable": 0 }, "operator": { - "total": 3, + "total": 4, "objc-direct": 0, "swift-generated": 0, "swift-specialized": 0, "type-only": 0, - "unsupported": 3, + "unsupported": 4, "not-applicable": 0 }, "protocol": { @@ -125,12 +125,12 @@ "not-applicable": 0 }, "struct": { - "total": 3, + "total": 5, "objc-direct": 0, - "swift-generated": 2, + "swift-generated": 5, "swift-specialized": 0, "type-only": 0, - "unsupported": 1, + "unsupported": 0, "not-applicable": 0 }, "typeAlias": { @@ -143,12 +143,12 @@ "not-applicable": 0 }, "typeMethod": { - "total": 2, + "total": 5, "objc-direct": 0, "swift-generated": 2, "swift-specialized": 0, "type-only": 0, - "unsupported": 0, + "unsupported": 3, "not-applicable": 0 }, "typeProperty": { @@ -171,22 +171,27 @@ } }, "reasons": { - "actor-isolated": 2, - "async": 2, - "closure": 4, - "collection": 1, - "enum-associated-values": 2, + "closure": 3, + "enum-associated-values": 1, + "existential": 1, "external-type-extension": 2, - "generic": 5, - "inout-parameter": 3, - "main-actor": 2, - "nested-type": 1, - "operator": 3, - "owner-not-bridged": 10, + "generic": 8, + "operator": 4, + "owner-not-bridged": 4, "subscript": 1, - "unbridged-type": 3 + "unbridged-type": 12 }, "symbols": [ + { + "id": "c:@M@SwiftDemo@objc(cs)Note", + "path": "Note", + "kind": "class", + "tier": "objc-direct", + "reasons": [ + "objc-visible" + ], + "location": "file://Sources/SwiftDemo/Views.swift:18" + }, { "id": "s:9SwiftDemo0B0C", "path": "Demo", @@ -230,49 +235,56 @@ "id": "s:9SwiftDemo10ShapeErrorO", "path": "ShapeError", "kind": "enum", - "tier": "unsupported", - "reasons": [ - "enum-associated-values" - ], + "tier": "swift-generated", "location": "file://Sources/SwiftDemo/Shapes.swift:55" }, { "id": "s:9SwiftDemo10ShapeErrorO11invalidSideyACSdcACmF", "path": "ShapeError.invalidSide(_:)", "kind": "enumCase", - "tier": "unsupported", - "reasons": [ - "owner-not-bridged" - ], + "tier": "swift-generated", + "jsName": "invalidSide", "location": "file://Sources/SwiftDemo/Shapes.swift:56" }, { "id": "s:9SwiftDemo10ShapeErrorO12tooManySidesyACSi_SitcACmF", "path": "ShapeError.tooManySides(count:limit:)", "kind": "enumCase", - "tier": "unsupported", - "reasons": [ - "owner-not-bridged" - ], + "tier": "swift-generated", + "jsName": "tooManySides", "location": "file://Sources/SwiftDemo/Shapes.swift:57" }, { "id": "s:9SwiftDemo10ShapeErrorO7unknownyA2CmF", "path": "ShapeError.unknown", "kind": "enumCase", - "tier": "unsupported", - "reasons": [ - "owner-not-bridged" - ], + "tier": "swift-generated", + "jsName": "unknown", "location": "file://Sources/SwiftDemo/Shapes.swift:58" }, + { + "id": "s:9SwiftDemo10allFlavorsSayAA6FlavorOGyF", + "path": "allFlavors()", + "kind": "function", + "tier": "swift-generated", + "jsName": "allFlavors", + "location": "file://Sources/SwiftDemo/Values.swift:64" + }, { "id": "s:9SwiftDemo10echoUInt64ys0D0VADF", "path": "echoUInt64(_:)", "kind": "function", "tier": "swift-generated", "jsName": "echoUInt64", - "location": "file://Sources/SwiftDemo/Values.swift:10" + "location": "file://Sources/SwiftDemo/Values.swift:12" + }, + { + "id": "s:9SwiftDemo10greetLater_10completionySSSg_yADYbctF", + "path": "greetLater(_:completion:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "greetLater", + "location": "file://Sources/SwiftDemo/Values.swift:81" }, { "id": "s:9SwiftDemo10largestIntSiyF", @@ -280,7 +292,23 @@ "kind": "function", "tier": "swift-generated", "jsName": "largestInt", - "location": "file://Sources/SwiftDemo/Values.swift:11" + "location": "file://Sources/SwiftDemo/Values.swift:13" + }, + { + "id": "s:9SwiftDemo10namesLaterySaySSGSiYaF", + "path": "namesLater(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "namesLater", + "location": "file://Sources/SwiftDemo/Values.swift:70" + }, + { + "id": "s:9SwiftDemo10wordCountsySDySSSiGSaySSGF", + "path": "wordCounts(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "wordCounts", + "location": "file://Sources/SwiftDemo/Values.swift:59" }, { "id": "s:9SwiftDemo11Coordinatesa", @@ -290,86 +318,68 @@ "reasons": [ "type-alias" ], - "location": "file://Sources/SwiftDemo/Shapes.swift:142" + "location": "file://Sources/SwiftDemo/Shapes.swift:143" }, { "id": "s:9SwiftDemo11MeasurementO", "path": "Measurement", "kind": "enum", - "tier": "unsupported", - "reasons": [ - "enum-associated-values" - ], + "tier": "swift-generated", "location": "file://Sources/SwiftDemo/Shapes.swift:61" }, { "id": "s:9SwiftDemo11MeasurementO4UnitV", "path": "Measurement.Unit", "kind": "struct", - "tier": "unsupported", - "reasons": [ - "nested-type" - ], + "tier": "swift-generated", "location": "file://Sources/SwiftDemo/Shapes.swift:66" }, { "id": "s:9SwiftDemo11MeasurementO4UnitV6symbolAESS_tcfc", "path": "Measurement.Unit.init(symbol:)", "kind": "initializer", - "tier": "unsupported", - "reasons": [ - "owner-not-bridged" - ], + "tier": "swift-generated", + "jsName": "constructor", "location": "file://Sources/SwiftDemo/Shapes.swift:68" }, { "id": "s:9SwiftDemo11MeasurementO4UnitV6symbolSSvp", "path": "Measurement.Unit.symbol", "kind": "instanceProperty", - "tier": "unsupported", - "reasons": [ - "owner-not-bridged" - ], + "tier": "swift-generated", + "jsName": "symbol", "location": "file://Sources/SwiftDemo/Shapes.swift:67" }, { "id": "s:9SwiftDemo11MeasurementO4areayACSd_SdtcACmF", "path": "Measurement.area(width:height:)", "kind": "enumCase", - "tier": "unsupported", - "reasons": [ - "owner-not-bridged" - ], + "tier": "swift-generated", + "jsName": "area", "location": "file://Sources/SwiftDemo/Shapes.swift:63" }, { "id": "s:9SwiftDemo11MeasurementO4noneyA2CmF", "path": "Measurement.none", "kind": "enumCase", - "tier": "unsupported", - "reasons": [ - "owner-not-bridged" - ], + "tier": "swift-generated", + "jsName": "none", "location": "file://Sources/SwiftDemo/Shapes.swift:64" }, { "id": "s:9SwiftDemo11MeasurementO6isNoneSbvp", "path": "Measurement.isNone", "kind": "instanceProperty", - "tier": "unsupported", - "reasons": [ - "owner-not-bridged" - ], + "tier": "swift-generated", + "jsName": "isNone", "location": "file://Sources/SwiftDemo/Shapes.swift:71" }, { "id": "s:9SwiftDemo11MeasurementO6lengthyACSdcACmF", "path": "Measurement.length(_:)", "kind": "enumCase", - "tier": "unsupported", - "reasons": [ - "owner-not-bridged" - ], + "tier": "swift-generated", + "jsName": "length", "location": "file://Sources/SwiftDemo/Shapes.swift:62" }, { @@ -378,7 +388,47 @@ "kind": "function", "tier": "swift-generated", "jsName": "checkedSide", - "location": "file://Sources/SwiftDemo/Values.swift:4" + "location": "file://Sources/SwiftDemo/Values.swift:6" + }, + { + "id": "s:9SwiftDemo11delayedEcho_5afterS2S_SdtYaKF", + "path": "delayedEcho(_:after:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "delayedEcho", + "location": "file://Sources/SwiftDemo/Values.swift:30" + }, + { + "id": "s:9SwiftDemo12firstSubview2ofSo6UIViewCSgAE_tF", + "path": "firstSubview(of:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "firstSubview", + "location": "file://Sources/SwiftDemo/Views.swift:16" + }, + { + "id": "s:9SwiftDemo12measureLateryAA11MeasurementOSdYaF", + "path": "measureLater(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "measureLater", + "location": "file://Sources/SwiftDemo/Values.swift:114" + }, + { + "id": "s:9SwiftDemo12measurementsSayAA11MeasurementOGyF", + "path": "measurements()", + "kind": "function", + "tier": "swift-generated", + "jsName": "measurements", + "location": "file://Sources/SwiftDemo/Values.swift:112" + }, + { + "id": "s:9SwiftDemo12swapTrackersyyAA7TrackerCz_ADztF", + "path": "swapTrackers(_:_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "swapTrackers", + "location": "file://Sources/SwiftDemo/Values.swift:173" }, { "id": "s:9SwiftDemo13PrecipitationO", @@ -424,7 +474,7 @@ "kind": "variable", "tier": "swift-generated", "jsName": "defaultFlavor", - "location": "file://Sources/SwiftDemo/Shapes.swift:140" + "location": "file://Sources/SwiftDemo/Shapes.swift:141" }, { "id": "s:9SwiftDemo13globalCounterSivp", @@ -432,7 +482,7 @@ "kind": "variable", "tier": "swift-generated", "jsName": "globalCounter", - "location": "file://Sources/SwiftDemo/Shapes.swift:141" + "location": "file://Sources/SwiftDemo/Shapes.swift:142" }, { "id": "s:9SwiftDemo16makeDefaultPointAA0E0VyF", @@ -440,7 +490,89 @@ "kind": "function", "tier": "swift-generated", "jsName": "makeDefaultPoint", - "location": "file://Sources/SwiftDemo/Shapes.swift:139" + "location": "file://Sources/SwiftDemo/Shapes.swift:140" + }, + { + "id": "s:9SwiftDemo16makeTrackerLater2idAA0D0CSi_tYaF", + "path": "makeTrackerLater(id:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "makeTrackerLater", + "location": "file://Sources/SwiftDemo/Values.swift:36" + }, + { + "id": "s:9SwiftDemo3JobO", + "path": "Job", + "kind": "enum", + "tier": "unsupported", + "reasons": [ + "enum-associated-values", + "closure" + ], + "location": "file://Sources/SwiftDemo/Values.swift:156" + }, + { + "id": "s:9SwiftDemo3JobO3runyACyyccACmF", + "path": "Job.run(_:)", + "kind": "enumCase", + "tier": "unsupported", + "reasons": [ + "owner-not-bridged" + ], + "location": "file://Sources/SwiftDemo/Values.swift:157" + }, + { + "id": "s:9SwiftDemo3JobO4idleyA2CmF", + "path": "Job.idle", + "kind": "enumCase", + "tier": "unsupported", + "reasons": [ + "owner-not-bridged" + ], + "location": "file://Sources/SwiftDemo/Values.swift:158" + }, + { + "id": "s:9SwiftDemo3JobO6TicketV", + "path": "Job.Ticket", + "kind": "struct", + "tier": "swift-generated", + "location": "file://Sources/SwiftDemo/Values.swift:160" + }, + { + "id": "s:9SwiftDemo3JobO6TicketV2idAESi_tcfc", + "path": "Job.Ticket.init(id:)", + "kind": "initializer", + "tier": "swift-generated", + "jsName": "constructor", + "location": "file://Sources/SwiftDemo/Values.swift:162" + }, + { + "id": "s:9SwiftDemo3JobO6TicketV2idSivp", + "path": "Job.Ticket.id", + "kind": "instanceProperty", + "tier": "swift-generated", + "jsName": "id", + "location": "file://Sources/SwiftDemo/Values.swift:161" + }, + { + "id": "s:9SwiftDemo4NoteC4textACSS_tcfc", + "path": "Note.init(text:)", + "kind": "initializer", + "tier": "unsupported", + "reasons": [ + "owner-not-bridged" + ], + "location": "file://Sources/SwiftDemo/Views.swift:20" + }, + { + "id": "s:9SwiftDemo4NoteC4textSSvp", + "path": "Note.text", + "kind": "instanceProperty", + "tier": "unsupported", + "reasons": [ + "owner-not-bridged" + ], + "location": "file://Sources/SwiftDemo/Views.swift:19" }, { "id": "s:9SwiftDemo4RingV", @@ -491,6 +623,62 @@ "jsName": "expand", "location": "file://Sources/SwiftDemo/Shapes.swift:86" }, + { + "id": "s:9SwiftDemo4area2ofSdAA11MeasurementO_tF", + "path": "area(of:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "area", + "location": "file://Sources/SwiftDemo/Values.swift:100" + }, + { + "id": "s:9SwiftDemo4bumpyySizF", + "path": "bump(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "bump", + "location": "file://Sources/SwiftDemo/Values.swift:166" + }, + { + "id": "s:9SwiftDemo4echoyAA7PayloadOADF", + "path": "echo(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "echo", + "location": "file://Sources/SwiftDemo/Values.swift:153" + }, + { + "id": "s:9SwiftDemo4host2ofSSSg10Foundation3URLV_tF", + "path": "host(of:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "host", + "location": "file://Sources/SwiftDemo/Values.swift:66" + }, + { + "id": "s:9SwiftDemo4rampy10Foundation4DataVSiF", + "path": "ramp(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "ramp", + "location": "file://Sources/SwiftDemo/Values.swift:69" + }, + { + "id": "s:9SwiftDemo4tagsySaySiGSaySo6UIViewCGF", + "path": "tags(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "tags", + "location": "file://Sources/SwiftDemo/Views.swift:14" + }, + { + "id": "s:9SwiftDemo4text2ofSSAA4NoteC_tF", + "path": "text(of:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "text", + "location": "file://Sources/SwiftDemo/Views.swift:24" + }, { "id": "s:9SwiftDemo5PointV", "path": "Point", @@ -568,20 +756,52 @@ ], "location": "file://Sources/SwiftDemo/Shapes.swift:5" }, + { + "id": "s:9SwiftDemo5clearyySSSgzF", + "path": "clear(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "clear", + "location": "file://Sources/SwiftDemo/Values.swift:172" + }, + { + "id": "s:9SwiftDemo5halveyySizKF", + "path": "halve(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "halve", + "location": "file://Sources/SwiftDemo/Values.swift:168" + }, + { + "id": "s:9SwiftDemo5namesySaySSGSiF", + "path": "names(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "names", + "location": "file://Sources/SwiftDemo/Values.swift:55" + }, { "id": "s:9SwiftDemo5shoutySSSgACF", "path": "shout(_:)", "kind": "function", "tier": "swift-generated", "jsName": "shout", - "location": "file://Sources/SwiftDemo/Values.swift:12" + "location": "file://Sources/SwiftDemo/Values.swift:14" + }, + { + "id": "s:9SwiftDemo5totalySdSaySdGF", + "path": "total(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "total", + "location": "file://Sources/SwiftDemo/Values.swift:56" }, { "id": "s:9SwiftDemo6CanvasC", "path": "Canvas", "kind": "class", "tier": "swift-generated", - "location": "file://Sources/SwiftDemo/Shapes.swift:107" + "location": "file://Sources/SwiftDemo/Shapes.swift:108" }, { "id": "s:9SwiftDemo6CanvasC4drawyyAA5Shape_pF", @@ -589,19 +809,17 @@ "kind": "instanceMethod", "tier": "unsupported", "reasons": [ - "main-actor" + "existential" ], - "location": "file://Sources/SwiftDemo/Shapes.swift:109" + "location": "file://Sources/SwiftDemo/Shapes.swift:110" }, { "id": "s:9SwiftDemo6CanvasCACycfc", "path": "Canvas.init()", "kind": "initializer", - "tier": "unsupported", - "reasons": [ - "main-actor" - ], - "location": "file://Sources/SwiftDemo/Shapes.swift:108" + "tier": "swift-generated", + "jsName": "constructor", + "location": "file://Sources/SwiftDemo/Shapes.swift:109" }, { "id": "s:9SwiftDemo6FlavorO", @@ -646,7 +864,7 @@ "path": "Loader", "kind": "class", "tier": "swift-generated", - "location": "file://Sources/SwiftDemo/Shapes.swift:112" + "location": "file://Sources/SwiftDemo/Shapes.swift:113" }, { "id": "s:9SwiftDemo6LoaderC10modernOnlyyyF", @@ -654,7 +872,7 @@ "kind": "instanceMethod", "tier": "swift-generated", "jsName": "modernOnly", - "location": "file://Sources/SwiftDemo/Shapes.swift:130" + "location": "file://Sources/SwiftDemo/Shapes.swift:131" }, { "id": "s:9SwiftDemo6LoaderC11legacyFetchyyF", @@ -662,7 +880,7 @@ "kind": "instanceMethod", "tier": "swift-generated", "jsName": "legacyFetch", - "location": "file://Sources/SwiftDemo/Shapes.swift:133" + "location": "file://Sources/SwiftDemo/Shapes.swift:134" }, { "id": "s:9SwiftDemo6LoaderC14withCompletionyyys6ResultOySSAA10ShapeErrorOGcF", @@ -670,49 +888,41 @@ "kind": "instanceMethod", "tier": "unsupported", "reasons": [ - "closure" + "unbridged-type:Swift.Result" ], - "location": "file://Sources/SwiftDemo/Shapes.swift:122" + "location": "file://Sources/SwiftDemo/Shapes.swift:123" }, { "id": "s:9SwiftDemo6LoaderC4eachyyySiXEF", "path": "Loader.each(_:)", "kind": "instanceMethod", - "tier": "unsupported", - "reasons": [ - "closure" - ], - "location": "file://Sources/SwiftDemo/Shapes.swift:123" + "tier": "swift-generated", + "jsName": "each", + "location": "file://Sources/SwiftDemo/Shapes.swift:124" }, { "id": "s:9SwiftDemo6LoaderC4load4path10Foundation4DataVSS_tKF", "path": "Loader.load(path:)", "kind": "instanceMethod", - "tier": "unsupported", - "reasons": [ - "unbridged-type:Foundation.Data" - ], - "location": "file://Sources/SwiftDemo/Shapes.swift:115" + "tier": "swift-generated", + "jsName": "load", + "location": "file://Sources/SwiftDemo/Shapes.swift:116" }, { "id": "s:9SwiftDemo6LoaderC4wait7secondsySd_tYaF", "path": "Loader.wait(seconds:)", "kind": "instanceMethod", - "tier": "unsupported", - "reasons": [ - "async" - ], - "location": "file://Sources/SwiftDemo/Shapes.swift:117" + "tier": "swift-generated", + "jsName": "wait", + "location": "file://Sources/SwiftDemo/Shapes.swift:118" }, { "id": "s:9SwiftDemo6LoaderC5fetch3urlSS10Foundation3URLV_tYaKF", "path": "Loader.fetch(url:)", "kind": "instanceMethod", - "tier": "unsupported", - "reasons": [ - "async" - ], - "location": "file://Sources/SwiftDemo/Shapes.swift:116" + "tier": "swift-generated", + "jsName": "fetch", + "location": "file://Sources/SwiftDemo/Shapes.swift:117" }, { "id": "s:9SwiftDemo6LoaderC5first2ofxSgSayxG_tlF", @@ -722,27 +932,23 @@ "reasons": [ "generic" ], - "location": "file://Sources/SwiftDemo/Shapes.swift:120" + "location": "file://Sources/SwiftDemo/Shapes.swift:121" }, { "id": "s:9SwiftDemo6LoaderC6lookup5table3keySiSgSDySSSiG_SStF", "path": "Loader.lookup(table:key:)", "kind": "instanceMethod", - "tier": "unsupported", - "reasons": [ - "collection" - ], - "location": "file://Sources/SwiftDemo/Shapes.swift:125" + "tier": "swift-generated", + "jsName": "lookup", + "location": "file://Sources/SwiftDemo/Shapes.swift:126" }, { "id": "s:9SwiftDemo6LoaderC6updateyyAA5PointVzF", "path": "Loader.update(_:)", "kind": "instanceMethod", - "tier": "unsupported", - "reasons": [ - "inout-parameter" - ], - "location": "file://Sources/SwiftDemo/Shapes.swift:127" + "tier": "swift-generated", + "jsName": "update", + "location": "file://Sources/SwiftDemo/Shapes.swift:128" }, { "id": "s:9SwiftDemo6LoaderC8oldFetchyyF", @@ -750,7 +956,7 @@ "kind": "instanceMethod", "tier": "swift-generated", "jsName": "oldFetch", - "location": "file://Sources/SwiftDemo/Shapes.swift:136" + "location": "file://Sources/SwiftDemo/Shapes.swift:137" }, { "id": "s:9SwiftDemo6LoaderC9transformyxxAA5ShapeRzlF", @@ -760,7 +966,7 @@ "reasons": [ "generic" ], - "location": "file://Sources/SwiftDemo/Shapes.swift:119" + "location": "file://Sources/SwiftDemo/Shapes.swift:120" }, { "id": "s:9SwiftDemo6LoaderCACycfc", @@ -768,7 +974,7 @@ "kind": "initializer", "tier": "swift-generated", "jsName": "constructor", - "location": "file://Sources/SwiftDemo/Shapes.swift:113" + "location": "file://Sources/SwiftDemo/Shapes.swift:114" }, { "id": "s:9SwiftDemo6SquareC", @@ -825,6 +1031,14 @@ "jsName": "sides", "location": "file://Sources/SwiftDemo/Shapes.swift:44" }, + { + "id": "s:9SwiftDemo6append_2toySS_SaySSGztF", + "path": "append(_:to:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "append", + "location": "file://Sources/SwiftDemo/Values.swift:167" + }, { "id": "s:9SwiftDemo7CounterC", "path": "Counter", @@ -832,33 +1046,37 @@ "tier": "swift-generated", "location": "file://Sources/SwiftDemo/Shapes.swift:96" }, + { + "id": "s:9SwiftDemo7CounterC4stepSivp", + "path": "Counter.step", + "kind": "instanceProperty", + "tier": "swift-generated", + "jsName": "step", + "location": "file://Sources/SwiftDemo/Shapes.swift:98" + }, { "id": "s:9SwiftDemo7CounterC5labelSSyF", "path": "Counter.label()", "kind": "instanceMethod", "tier": "swift-generated", "jsName": "label", - "location": "file://Sources/SwiftDemo/Shapes.swift:103" + "location": "file://Sources/SwiftDemo/Shapes.swift:104" }, { "id": "s:9SwiftDemo7CounterC5valueSivp", "path": "Counter.value", "kind": "instanceProperty", - "tier": "unsupported", - "reasons": [ - "actor-isolated" - ], + "tier": "swift-generated", + "jsName": "value", "location": "file://Sources/SwiftDemo/Shapes.swift:97" }, { "id": "s:9SwiftDemo7CounterC9incrementSiyF", "path": "Counter.increment()", "kind": "instanceMethod", - "tier": "unsupported", - "reasons": [ - "actor-isolated" - ], - "location": "file://Sources/SwiftDemo/Shapes.swift:99" + "tier": "swift-generated", + "jsName": "increment", + "location": "file://Sources/SwiftDemo/Shapes.swift:100" }, { "id": "s:9SwiftDemo7CounterCACycfc", @@ -866,7 +1084,46 @@ "kind": "initializer", "tier": "swift-generated", "jsName": "constructor", - "location": "file://Sources/SwiftDemo/Shapes.swift:98" + "location": "file://Sources/SwiftDemo/Shapes.swift:99" + }, + { + "id": "s:9SwiftDemo7FormulaO", + "path": "Formula", + "kind": "enum", + "tier": "swift-generated", + "location": "file://Sources/SwiftDemo/Values.swift:129" + }, + { + "id": "s:9SwiftDemo7FormulaO3sumyA2C_ACtcACmF", + "path": "Formula.sum(_:_:)", + "kind": "enumCase", + "tier": "swift-generated", + "jsName": "sum", + "location": "file://Sources/SwiftDemo/Values.swift:131" + }, + { + "id": "s:9SwiftDemo7FormulaO5valueSdvp", + "path": "Formula.value", + "kind": "instanceProperty", + "tier": "swift-generated", + "jsName": "value", + "location": "file://Sources/SwiftDemo/Values.swift:134" + }, + { + "id": "s:9SwiftDemo7FormulaO6negateyA2CcACmF", + "path": "Formula.negate(_:)", + "kind": "enumCase", + "tier": "swift-generated", + "jsName": "negate", + "location": "file://Sources/SwiftDemo/Values.swift:132" + }, + { + "id": "s:9SwiftDemo7FormulaO6numberyACSdcACmF", + "path": "Formula.number(_:)", + "kind": "enumCase", + "tier": "swift-generated", + "jsName": "number", + "location": "file://Sources/SwiftDemo/Values.swift:130" }, { "id": "s:9SwiftDemo7GreeterP", @@ -888,6 +1145,92 @@ ], "location": "file://Sources/SwiftDemo/Demo.swift:2" }, + { + "id": "s:9SwiftDemo7PaletteC", + "path": "Palette", + "kind": "class", + "tier": "swift-generated", + "location": "file://Sources/SwiftDemo/Values.swift:42" + }, + { + "id": "s:9SwiftDemo7PaletteC11strokeLaterSiyYaF", + "path": "Palette.strokeLater()", + "kind": "instanceMethod", + "tier": "swift-generated", + "jsName": "strokeLater", + "location": "file://Sources/SwiftDemo/Values.swift:49" + }, + { + "id": "s:9SwiftDemo7PaletteC6strokeSiyF", + "path": "Palette.stroke()", + "kind": "instanceMethod", + "tier": "swift-generated", + "jsName": "stroke", + "location": "file://Sources/SwiftDemo/Values.swift:45" + }, + { + "id": "s:9SwiftDemo7PaletteC7strokesSivp", + "path": "Palette.strokes", + "kind": "instanceProperty", + "tier": "swift-generated", + "jsName": "strokes", + "location": "file://Sources/SwiftDemo/Values.swift:43" + }, + { + "id": "s:9SwiftDemo7PaletteCACycfc", + "path": "Palette.init()", + "kind": "initializer", + "tier": "swift-generated", + "jsName": "constructor", + "location": "file://Sources/SwiftDemo/Values.swift:44" + }, + { + "id": "s:9SwiftDemo7PayloadO", + "path": "Payload", + "kind": "enum", + "tier": "swift-generated", + "location": "file://Sources/SwiftDemo/Values.swift:145" + }, + { + "id": "s:9SwiftDemo7PayloadO5maybeyACSiSgcACmF", + "path": "Payload.maybe(_:)", + "kind": "enumCase", + "tier": "swift-generated", + "jsName": "maybe", + "location": "file://Sources/SwiftDemo/Values.swift:149" + }, + { + "id": "s:9SwiftDemo7PayloadO5namesyACSaySSGcACmF", + "path": "Payload.names(_:)", + "kind": "enumCase", + "tier": "swift-generated", + "jsName": "names", + "location": "file://Sources/SwiftDemo/Values.swift:150" + }, + { + "id": "s:9SwiftDemo7PayloadO5pointyAcA5PointVcACmF", + "path": "Payload.point(_:)", + "kind": "enumCase", + "tier": "swift-generated", + "jsName": "point", + "location": "file://Sources/SwiftDemo/Values.swift:147" + }, + { + "id": "s:9SwiftDemo7PayloadO6flavoryAcA6FlavorOcACmF", + "path": "Payload.flavor(_:)", + "kind": "enumCase", + "tier": "swift-generated", + "jsName": "flavor", + "location": "file://Sources/SwiftDemo/Values.swift:148" + }, + { + "id": "s:9SwiftDemo7PayloadO7trackeryAcA7TrackerCcACmF", + "path": "Payload.tracker(_:)", + "kind": "enumCase", + "tier": "swift-generated", + "jsName": "tracker", + "location": "file://Sources/SwiftDemo/Values.swift:146" + }, { "id": "s:9SwiftDemo7PolygonC", "path": "Polygon", @@ -935,6 +1278,36 @@ "jsName": "name", "location": "file://Sources/SwiftDemo/Shapes.swift:9" }, + { + "id": "s:9SwiftDemo7PolygonC5StyleO", + "path": "Polygon.Style", + "kind": "enum", + "tier": "swift-generated", + "location": "file://Sources/SwiftDemo/Extensions.swift:32" + }, + { + "id": "s:9SwiftDemo7PolygonC5StyleO5solidyA2EmF", + "path": "Polygon.Style.solid", + "kind": "enumCase", + "tier": "swift-generated", + "jsName": "solid", + "location": "file://Sources/SwiftDemo/Extensions.swift:32" + }, + { + "id": "s:9SwiftDemo7PolygonC5StyleO6dashedyA2EmF", + "path": "Polygon.Style.dashed", + "kind": "enumCase", + "tier": "swift-generated", + "jsName": "dashed", + "location": "file://Sources/SwiftDemo/Extensions.swift:32" + }, + { + "id": "s:9SwiftDemo7PolygonC5StyleO8rawValueAESgSS_tcfc", + "path": "Polygon.Style.init(rawValue:)", + "kind": "initializer", + "tier": "swift-generated", + "jsName": "constructor" + }, { "id": "s:9SwiftDemo7PolygonC5scale1x1yySd_SdtF", "path": "Polygon.scale(x:y:)", @@ -961,6 +1334,14 @@ "ambiguousOverload": true, "location": "file://Sources/SwiftDemo/Shapes.swift:24" }, + { + "id": "s:9SwiftDemo7PolygonC5styleAC5StyleOvp", + "path": "Polygon.style", + "kind": "instanceProperty", + "tier": "swift-generated", + "jsName": "style", + "location": "file://Sources/SwiftDemo/Extensions.swift:39" + }, { "id": "s:9SwiftDemo7PolygonC6sharedACvpZ", "path": "Polygon.shared", @@ -969,6 +1350,37 @@ "jsName": "shared", "location": "file://Sources/SwiftDemo/Shapes.swift:11" }, + { + "id": "s:9SwiftDemo7PolygonC7MetricsV", + "path": "Polygon.Metrics", + "kind": "struct", + "tier": "swift-generated", + "location": "file://Sources/SwiftDemo/Extensions.swift:34" + }, + { + "id": "s:9SwiftDemo7PolygonC7MetricsV9perimeterAESd_tcfc", + "path": "Polygon.Metrics.init(perimeter:)", + "kind": "initializer", + "tier": "swift-generated", + "jsName": "constructor", + "location": "file://Sources/SwiftDemo/Extensions.swift:36" + }, + { + "id": "s:9SwiftDemo7PolygonC7MetricsV9perimeterSdvp", + "path": "Polygon.Metrics.perimeter", + "kind": "instanceProperty", + "tier": "swift-generated", + "jsName": "perimeter", + "location": "file://Sources/SwiftDemo/Extensions.swift:35" + }, + { + "id": "s:9SwiftDemo7PolygonC7metrics4sideAC7MetricsVSd_tF", + "path": "Polygon.metrics(side:)", + "kind": "instanceMethod", + "tier": "swift-generated", + "jsName": "metrics", + "location": "file://Sources/SwiftDemo/Extensions.swift:40" + }, { "id": "s:9SwiftDemo7PolygonC8describeySSACSgFZ", "path": "Polygon.describe(_:)", @@ -992,7 +1404,7 @@ "path": "Tracker", "kind": "class", "tier": "swift-generated", - "location": "file://Sources/SwiftDemo/Values.swift:14" + "location": "file://Sources/SwiftDemo/Values.swift:16" }, { "id": "s:9SwiftDemo7TrackerC2idACSi_tcfc", @@ -1000,7 +1412,7 @@ "kind": "initializer", "tier": "swift-generated", "jsName": "constructor", - "location": "file://Sources/SwiftDemo/Values.swift:18" + "location": "file://Sources/SwiftDemo/Values.swift:20" }, { "id": "s:9SwiftDemo7TrackerC2idSivp", @@ -1008,7 +1420,7 @@ "kind": "instanceProperty", "tier": "swift-generated", "jsName": "id", - "location": "file://Sources/SwiftDemo/Values.swift:16" + "location": "file://Sources/SwiftDemo/Values.swift:18" }, { "id": "s:9SwiftDemo7TrackerC4sameACyF", @@ -1016,7 +1428,7 @@ "kind": "instanceMethod", "tier": "swift-generated", "jsName": "same", - "location": "file://Sources/SwiftDemo/Values.swift:25" + "location": "file://Sources/SwiftDemo/Values.swift:27" }, { "id": "s:9SwiftDemo7TrackerC9liveCountSivpZ", @@ -1024,7 +1436,126 @@ "kind": "typeProperty", "tier": "swift-generated", "jsName": "liveCount", - "location": "file://Sources/SwiftDemo/Values.swift:15" + "location": "file://Sources/SwiftDemo/Values.swift:17" + }, + { + "id": "s:9SwiftDemo7explainySSAA10ShapeErrorOF", + "path": "explain(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "explain", + "location": "file://Sources/SwiftDemo/Values.swift:121" + }, + { + "id": "s:9SwiftDemo7lengthsySDySSSiGSDyS2SGF", + "path": "lengths(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "lengths", + "location": "file://Sources/SwiftDemo/Values.swift:62" + }, + { + "id": "s:9SwiftDemo7measure_2byAA11MeasurementOSd_SdSgtF", + "path": "measure(_:by:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "measure", + "location": "file://Sources/SwiftDemo/Values.swift:107" + }, + { + "id": "s:9SwiftDemo7nextDay5after10Foundation4DateVAF_tF", + "path": "nextDay(after:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "nextDay", + "location": "file://Sources/SwiftDemo/Values.swift:65" + }, + { + "id": "s:9SwiftDemo7resolve_7against10Foundation3URLVSS_AFtF", + "path": "resolve(_:against:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "resolve", + "location": "file://Sources/SwiftDemo/Values.swift:67" + }, + { + "id": "s:9SwiftDemo8NotifierC", + "path": "Notifier", + "kind": "class", + "tier": "swift-generated", + "location": "file://Sources/SwiftDemo/Values.swift:87" + }, + { + "id": "s:9SwiftDemo8NotifierC12publishLateryySSF", + "path": "Notifier.publishLater(_:)", + "kind": "instanceMethod", + "tier": "swift-generated", + "jsName": "publishLater", + "location": "file://Sources/SwiftDemo/Values.swift:93" + }, + { + "id": "s:9SwiftDemo8NotifierC5clearyyF", + "path": "Notifier.clear()", + "kind": "instanceMethod", + "tier": "swift-generated", + "jsName": "clear", + "location": "file://Sources/SwiftDemo/Values.swift:97" + }, + { + "id": "s:9SwiftDemo8NotifierC5countSivp", + "path": "Notifier.count", + "kind": "instanceProperty", + "tier": "swift-generated", + "jsName": "count", + "location": "file://Sources/SwiftDemo/Values.swift:90" + }, + { + "id": "s:9SwiftDemo8NotifierC7publishyySSF", + "path": "Notifier.publish(_:)", + "kind": "instanceMethod", + "tier": "swift-generated", + "jsName": "publish", + "location": "file://Sources/SwiftDemo/Values.swift:92" + }, + { + "id": "s:9SwiftDemo8NotifierC9subscribeyyySSYbcF", + "path": "Notifier.subscribe(_:)", + "kind": "instanceMethod", + "tier": "swift-generated", + "jsName": "subscribe", + "location": "file://Sources/SwiftDemo/Values.swift:91" + }, + { + "id": "s:9SwiftDemo8NotifierCACycfc", + "path": "Notifier.init()", + "kind": "initializer", + "tier": "swift-generated", + "jsName": "constructor", + "location": "file://Sources/SwiftDemo/Values.swift:89" + }, + { + "id": "s:9SwiftDemo8centroid2ofAA5PointVSayAEG_tF", + "path": "centroid(of:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "centroid", + "location": "file://Sources/SwiftDemo/Values.swift:57" + }, + { + "id": "s:9SwiftDemo8checksumySi10Foundation4DataVF", + "path": "checksum(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "checksum", + "location": "file://Sources/SwiftDemo/Values.swift:68" + }, + { + "id": "s:9SwiftDemo8describeySSSo6UIViewCF", + "path": "describe(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "describe", + "location": "file://Sources/SwiftDemo/Views.swift:6" }, { "id": "s:9SwiftDemo8echoInt8ys0D0VADF", @@ -1032,7 +1563,71 @@ "kind": "function", "tier": "swift-generated", "jsName": "echoInt8", - "location": "file://Sources/SwiftDemo/Values.swift:9" + "location": "file://Sources/SwiftDemo/Values.swift:11" + }, + { + "id": "s:9SwiftDemo8makeNoteyAA0D0CSSF", + "path": "makeNote(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "makeNote", + "location": "file://Sources/SwiftDemo/Views.swift:23" + }, + { + "id": "s:9SwiftDemo8mirroredySaySaySiGGADF", + "path": "mirrored(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "mirrored", + "location": "file://Sources/SwiftDemo/Values.swift:58" + }, + { + "id": "s:9SwiftDemo8simplifyyAA7FormulaOADF", + "path": "simplify(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "simplify", + "location": "file://Sources/SwiftDemo/Values.swift:143" + }, + { + "id": "s:9SwiftDemo8trackersySayAA7TrackerCGSaySiGF", + "path": "trackers(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "trackers", + "location": "file://Sources/SwiftDemo/Values.swift:63" + }, + { + "id": "s:9SwiftDemo9countdown4from_ySi_ySi_SbtXEtF", + "path": "countdown(from:_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "countdown", + "location": "file://Sources/SwiftDemo/Values.swift:75" + }, + { + "id": "s:9SwiftDemo9makeLabelySo7UILabelCSSF", + "path": "makeLabel(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "makeLabel", + "location": "file://Sources/SwiftDemo/Views.swift:8" + }, + { + "id": "s:9SwiftDemo9noteLateryAA4NoteCSSYaF", + "path": "noteLater(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "noteLater", + "location": "file://Sources/SwiftDemo/Views.swift:26" + }, + { + "id": "s:9SwiftDemo9onMeasureyyyAA11MeasurementOXEF", + "path": "onMeasure(_:)", + "kind": "function", + "tier": "swift-generated", + "jsName": "onMeasure", + "location": "file://Sources/SwiftDemo/Values.swift:119" }, { "id": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", @@ -1052,6 +1647,15 @@ "operator" ] }, + { + "id": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "path": "Polygon.Style.!=(_:_:)", + "kind": "operator", + "tier": "unsupported", + "reasons": [ + "operator" + ] + }, { "id": "s:SS9SwiftDemoE7shoutedSSvp", "path": "String.shouted", @@ -1062,6 +1666,63 @@ ], "location": "file://Sources/SwiftDemo/Extensions.swift:19" }, + { + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", + "path": "Precipitation.rawAttachmentValueRepresentation", + "kind": "instanceProperty", + "tier": "unsupported", + "reasons": [ + "unbridged-type:CoreVideo.CVAttachmentRawValue" + ] + }, + { + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo6FlavorO", + "path": "Flavor.rawAttachmentValueRepresentation", + "kind": "instanceProperty", + "tier": "unsupported", + "reasons": [ + "unbridged-type:CoreVideo.CVAttachmentRawValue" + ] + }, + { + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "path": "Polygon.Style.rawAttachmentValueRepresentation", + "kind": "instanceProperty", + "tier": "unsupported", + "reasons": [ + "unbridged-type:CoreVideo.CVAttachmentRawValue" + ] + }, + { + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", + "path": "Precipitation.makeFromRawAttachmentValue(_:)", + "kind": "typeMethod", + "tier": "unsupported", + "reasons": [ + "generic", + "unbridged-type:CoreVideo.CVAttachmentRawValue" + ] + }, + { + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO", + "path": "Flavor.makeFromRawAttachmentValue(_:)", + "kind": "typeMethod", + "tier": "unsupported", + "reasons": [ + "generic", + "unbridged-type:CoreVideo.CVAttachmentRawValue" + ] + }, + { + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "path": "Polygon.Style.makeFromRawAttachmentValue(_:)", + "kind": "typeMethod", + "tier": "unsupported", + "reasons": [ + "generic", + "unbridged-type:CoreVideo.CVAttachmentRawValue" + ] + }, { "id": "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", "path": "Precipitation.hashValue", @@ -1076,13 +1737,20 @@ "tier": "swift-generated", "jsName": "hashValue" }, + { + "id": "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "path": "Polygon.Style.hashValue", + "kind": "instanceProperty", + "tier": "swift-generated", + "jsName": "hashValue" + }, { "id": "s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", "path": "Precipitation.hash(into:)", "kind": "instanceMethod", "tier": "unsupported", "reasons": [ - "inout-parameter" + "unbridged-type:Swift.Hasher" ] }, { @@ -1091,7 +1759,16 @@ "kind": "instanceMethod", "tier": "unsupported", "reasons": [ - "inout-parameter" + "unbridged-type:Swift.Hasher" + ] + }, + { + "id": "s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "path": "Polygon.Style.hash(into:)", + "kind": "instanceMethod", + "tier": "unsupported", + "reasons": [ + "unbridged-type:Swift.Hasher" ] }, { @@ -1155,10 +1832,8 @@ "id": "s:s5ErrorP10FoundationE20localizedDescriptionSSvp::SYNTHESIZED::s:9SwiftDemo10ShapeErrorO", "path": "ShapeError.localizedDescription", "kind": "instanceProperty", - "tier": "unsupported", - "reasons": [ - "owner-not-bridged" - ] + "tier": "swift-generated", + "jsName": "localizedDescription" } ] } diff --git a/metadata-generator/tests/swift/snapshots/SwiftDemo.ir.json b/metadata-generator/tests/swift/snapshots/SwiftDemo.ir.json index 3f25c082..1d222577 100644 --- a/metadata-generator/tests/swift/snapshots/SwiftDemo.ir.json +++ b/metadata-generator/tests/swift/snapshots/SwiftDemo.ir.json @@ -36,7 +36,51 @@ "s:9SwiftDemo10echoUInt64ys0D0VADF", "s:9SwiftDemo10largestIntSiyF", "s:9SwiftDemo5shoutySSSgACF", - "s:9SwiftDemo7TrackerC" + "s:9SwiftDemo7TrackerC", + "s:9SwiftDemo11delayedEcho_5afterS2S_SdtYaKF", + "s:9SwiftDemo16makeTrackerLater2idAA0D0CSi_tYaF", + "s:9SwiftDemo7PaletteC", + "s:9SwiftDemo5namesySaySSGSiF", + "s:9SwiftDemo5totalySdSaySdGF", + "s:9SwiftDemo8centroid2ofAA5PointVSayAEG_tF", + "s:9SwiftDemo8mirroredySaySaySiGGADF", + "s:9SwiftDemo10wordCountsySDySSSiGSaySSGF", + "s:9SwiftDemo7lengthsySDySSSiGSDyS2SGF", + "s:9SwiftDemo8trackersySayAA7TrackerCGSaySiGF", + "s:9SwiftDemo10allFlavorsSayAA6FlavorOGyF", + "s:9SwiftDemo7nextDay5after10Foundation4DateVAF_tF", + "s:9SwiftDemo4host2ofSSSg10Foundation3URLV_tF", + "s:9SwiftDemo7resolve_7against10Foundation3URLVSS_AFtF", + "s:9SwiftDemo8checksumySi10Foundation4DataVF", + "s:9SwiftDemo4rampy10Foundation4DataVSiF", + "s:9SwiftDemo10namesLaterySaySSGSiYaF", + "s:9SwiftDemo9countdown4from_ySi_ySi_SbtXEtF", + "s:9SwiftDemo10greetLater_10completionySSSg_yADYbctF", + "s:9SwiftDemo8NotifierC", + "s:9SwiftDemo4area2ofSdAA11MeasurementO_tF", + "s:9SwiftDemo7measure_2byAA11MeasurementOSd_SdSgtF", + "s:9SwiftDemo12measurementsSayAA11MeasurementOGyF", + "s:9SwiftDemo12measureLateryAA11MeasurementOSdYaF", + "s:9SwiftDemo9onMeasureyyyAA11MeasurementOXEF", + "s:9SwiftDemo7explainySSAA10ShapeErrorOF", + "s:9SwiftDemo7FormulaO", + "s:9SwiftDemo8simplifyyAA7FormulaOADF", + "s:9SwiftDemo7PayloadO", + "s:9SwiftDemo4echoyAA7PayloadOADF", + "s:9SwiftDemo3JobO", + "s:9SwiftDemo4bumpyySizF", + "s:9SwiftDemo6append_2toySS_SaySSGztF", + "s:9SwiftDemo5halveyySizKF", + "s:9SwiftDemo5clearyySSSgzF", + "s:9SwiftDemo12swapTrackersyyAA7TrackerCz_ADztF", + "s:9SwiftDemo8describeySSSo6UIViewCF", + "s:9SwiftDemo9makeLabelySo7UILabelCSSF", + "s:9SwiftDemo4tagsySaySiGSaySo6UIViewCGF", + "s:9SwiftDemo12firstSubview2ofSo6UIViewCSgAE_tF", + "c:@M@SwiftDemo@objc(cs)Note", + "s:9SwiftDemo8makeNoteyAA0D0CSSF", + "s:9SwiftDemo4text2ofSSAA4NoteC_tF", + "s:9SwiftDemo9noteLateryAA4NoteCSSYaF" ], "externalTypes": [ { @@ -59,6 +103,8 @@ } ], "externalNames": { + "c:objc(cs)NSObject": "ObjectiveC.NSObject", + "c:objc(pl)NSObject": "ObjectiveC.NSObjectProtocol", "s:SH": "Swift.Hashable", "s:SQ": "Swift.Equatable", "s:SS": "Swift.String", @@ -67,12 +113,40 @@ "s:ScA": "_Concurrency.Actor", "s:s16SendableMetatypeP": "Swift.SendableMetatype", "s:s23CustomStringConvertibleP": "Swift.CustomStringConvertible", + "s:s28CustomDebugStringConvertibleP": "Swift.CustomDebugStringConvertible", "s:s5ErrorP": "Swift.Error", + "s:s7CVarArgP": "Swift.CVarArg", "s:s8CopyableP": "Swift.Copyable", "s:s8SendableP": "Swift.Sendable", "s:s9EscapableP": "Swift.Escapable" }, "symbols": [ + { + "id": "c:@M@SwiftDemo@objc(cs)Note", + "kind": "class", + "path": "Note", + "name": "Note", + "access": "public", + "declaration": "final class Note", + "modifiers": [ + "final" + ], + "location": "file://Sources/SwiftDemo/Views.swift:17:19", + "graph": "SwiftDemo.symbols.json", + "members": [ + "s:9SwiftDemo4NoteC4textSSvp", + "s:9SwiftDemo4NoteC4textACSS_tcfc" + ], + "conformances": [ + "c:objc(pl)NSObject", + "s:SH", + "s:SQ", + "s:s23CustomStringConvertibleP", + "s:s28CustomDebugStringConvertibleP", + "s:s7CVarArgP" + ], + "superclass": "c:objc(cs)NSObject" + }, { "id": "s:9SwiftDemo0B0C", "kind": "class", @@ -288,6 +362,22 @@ "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo10ShapeErrorO" }, + { + "id": "s:9SwiftDemo10allFlavorsSayAA6FlavorOGyF", + "kind": "function", + "path": "allFlavors()", + "name": "allFlavors()", + "access": "public", + "declaration": "func allFlavors() -> [Flavor]", + "returns": { + "spelling": "[Flavor]", + "references": [ + "s:9SwiftDemo6FlavorO" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:63:12", + "graph": "SwiftDemo.symbols.json" + }, { "id": "s:9SwiftDemo10echoUInt64ys0D0VADF", "kind": "function", @@ -312,7 +402,43 @@ "s:s6UInt64V" ] }, - "location": "file://Sources/SwiftDemo/Values.swift:9:12", + "location": "file://Sources/SwiftDemo/Values.swift:11:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo10greetLater_10completionySSSg_yADYbctF", + "kind": "function", + "path": "greetLater(_:completion:)", + "name": "greetLater(_:completion:)", + "access": "public", + "declaration": "func greetLater(_ name: String?, completion: @escaping @Sendable (String?) -> Void)", + "parameters": [ + { + "internalName": "name", + "type": { + "spelling": "String?", + "references": [ + "s:SS" + ] + } + }, + { + "label": "completion", + "internalName": "completion", + "type": { + "spelling": "(String?) -> Void", + "references": [ + "s:SS", + "s:s4Voida" + ] + }, + "attributes": [ + "@escaping", + "@Sendable" + ] + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:80:12", "graph": "SwiftDemo.symbols.json" }, { @@ -328,7 +454,63 @@ "s:Si" ] }, - "location": "file://Sources/SwiftDemo/Values.swift:10:12", + "location": "file://Sources/SwiftDemo/Values.swift:12:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo10namesLaterySaySSGSiYaF", + "kind": "function", + "path": "namesLater(_:)", + "name": "namesLater(_:)", + "access": "public", + "declaration": "func namesLater(_ count: Int) async -> [String]", + "parameters": [ + { + "internalName": "count", + "type": { + "spelling": "Int", + "references": [ + "s:Si" + ] + } + } + ], + "returns": { + "spelling": "[String]", + "references": [ + "s:SS" + ] + }, + "async": true, + "location": "file://Sources/SwiftDemo/Values.swift:69:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo10wordCountsySDySSSiGSaySSGF", + "kind": "function", + "path": "wordCounts(_:)", + "name": "wordCounts(_:)", + "access": "public", + "declaration": "func wordCounts(_ words: [String]) -> [String : Int]", + "parameters": [ + { + "internalName": "words", + "type": { + "spelling": "[String]", + "references": [ + "s:SS" + ] + } + } + ], + "returns": { + "spelling": "[String : Int]", + "references": [ + "s:SS", + "s:Si" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:58:12", "graph": "SwiftDemo.symbols.json" }, { @@ -345,7 +527,7 @@ "s:Sd" ] }, - "location": "file://Sources/SwiftDemo/Shapes.swift:141:17", + "location": "file://Sources/SwiftDemo/Shapes.swift:142:17", "graph": "SwiftDemo.symbols.json" }, { @@ -529,7 +711,150 @@ ] }, "throws": true, - "location": "file://Sources/SwiftDemo/Values.swift:3:12", + "location": "file://Sources/SwiftDemo/Values.swift:5:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo11delayedEcho_5afterS2S_SdtYaKF", + "kind": "function", + "path": "delayedEcho(_:after:)", + "name": "delayedEcho(_:after:)", + "access": "public", + "declaration": "func delayedEcho(_ text: String, after seconds: Double) async throws -> String", + "parameters": [ + { + "internalName": "text", + "type": { + "spelling": "String", + "references": [ + "s:SS" + ] + } + }, + { + "label": "after", + "internalName": "seconds", + "type": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + } + } + ], + "returns": { + "spelling": "String", + "references": [ + "s:SS" + ] + }, + "async": true, + "throws": true, + "location": "file://Sources/SwiftDemo/Values.swift:29:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo12firstSubview2ofSo6UIViewCSgAE_tF", + "kind": "function", + "path": "firstSubview(of:)", + "name": "firstSubview(of:)", + "access": "public", + "declaration": "func firstSubview(of view: UIView) -> UIView?", + "parameters": [ + { + "label": "of", + "internalName": "view", + "type": { + "spelling": "UIView", + "references": [ + "c:objc(cs)UIView" + ] + } + } + ], + "returns": { + "spelling": "UIView?", + "references": [ + "c:objc(cs)UIView" + ] + }, + "location": "file://Sources/SwiftDemo/Views.swift:15:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo12measureLateryAA11MeasurementOSdYaF", + "kind": "function", + "path": "measureLater(_:)", + "name": "measureLater(_:)", + "access": "public", + "declaration": "func measureLater(_ width: Double) async -> Measurement", + "parameters": [ + { + "internalName": "width", + "type": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + } + } + ], + "returns": { + "spelling": "Measurement", + "references": [ + "s:9SwiftDemo11MeasurementO" + ] + }, + "async": true, + "location": "file://Sources/SwiftDemo/Values.swift:113:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo12measurementsSayAA11MeasurementOGyF", + "kind": "function", + "path": "measurements()", + "name": "measurements()", + "access": "public", + "declaration": "func measurements() -> [Measurement]", + "returns": { + "spelling": "[Measurement]", + "references": [ + "s:9SwiftDemo11MeasurementO" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:111:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo12swapTrackersyyAA7TrackerCz_ADztF", + "kind": "function", + "path": "swapTrackers(_:_:)", + "name": "swapTrackers(_:_:)", + "access": "public", + "declaration": "func swapTrackers(_ a: inout Tracker, _ b: inout Tracker)", + "parameters": [ + { + "internalName": "a", + "type": { + "spelling": "Tracker", + "references": [ + "s:9SwiftDemo7TrackerC" + ] + }, + "modifier": "inout" + }, + { + "internalName": "b", + "type": { + "spelling": "Tracker", + "references": [ + "s:9SwiftDemo7TrackerC" + ] + }, + "modifier": "inout" + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:172:12", "graph": "SwiftDemo.symbols.json" }, { @@ -547,6 +872,8 @@ "s:9SwiftDemo13PrecipitationO4noneyA2CmF", "s:9SwiftDemo13PrecipitationO8rawValueACSgSS_tcfc", "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", + "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", + "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", "s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo13PrecipitationO" ], @@ -628,7 +955,7 @@ }, "settable": false, "let": true, - "location": "file://Sources/SwiftDemo/Shapes.swift:139:11", + "location": "file://Sources/SwiftDemo/Shapes.swift:140:11", "graph": "SwiftDemo.symbols.json" }, { @@ -645,7 +972,7 @@ ] }, "settable": true, - "location": "file://Sources/SwiftDemo/Shapes.swift:140:11", + "location": "file://Sources/SwiftDemo/Shapes.swift:141:11", "graph": "SwiftDemo.symbols.json" }, { @@ -661,74 +988,248 @@ "s:9SwiftDemo5PointV" ] }, - "location": "file://Sources/SwiftDemo/Shapes.swift:138:12", + "location": "file://Sources/SwiftDemo/Shapes.swift:139:12", "graph": "SwiftDemo.symbols.json" }, { - "id": "s:9SwiftDemo4RingV", - "kind": "struct", - "path": "Ring", - "name": "Ring", - "access": "public", - "declaration": "struct Ring", - "location": "file://Sources/SwiftDemo/Shapes.swift:76:14", - "graph": "SwiftDemo.symbols.json", - "members": [ - "s:9SwiftDemo4RingV5innerAA5PointVvp", - "s:9SwiftDemo4RingV5outerAA5PointVvp", - "s:9SwiftDemo4RingV5inner5outerAcA5PointV_AGtcfc", - "s:9SwiftDemo4RingV6expand2byySd_tF", - "s:9SwiftDemo4RingV1poiyA2C_ACtFZ" - ] - }, - { - "id": "s:9SwiftDemo4RingV1poiyA2C_ACtFZ", - "kind": "operator", - "path": "Ring.+(_:_:)", - "name": "+(_:_:)", + "id": "s:9SwiftDemo16makeTrackerLater2idAA0D0CSi_tYaF", + "kind": "function", + "path": "makeTrackerLater(id:)", + "name": "makeTrackerLater(id:)", "access": "public", - "declaration": "static func + (lhs: Ring, rhs: Ring) -> Ring", - "modifiers": [ - "static" - ], - "static": true, + "declaration": "func makeTrackerLater(id: Int) async -> Tracker", "parameters": [ { - "internalName": "lhs", - "type": { - "spelling": "Ring", - "references": [ - "s:9SwiftDemo4RingV" - ] - } - }, - { - "internalName": "rhs", + "label": "id", + "internalName": "id", "type": { - "spelling": "Ring", + "spelling": "Int", "references": [ - "s:9SwiftDemo4RingV" + "s:Si" ] } } ], "returns": { - "spelling": "Ring", + "spelling": "Tracker", "references": [ - "s:9SwiftDemo4RingV" + "s:9SwiftDemo7TrackerC" ] }, - "location": "file://Sources/SwiftDemo/Shapes.swift:90:23", - "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo4RingV" + "async": true, + "location": "file://Sources/SwiftDemo/Values.swift:35:12", + "graph": "SwiftDemo.symbols.json" }, { - "id": "s:9SwiftDemo4RingV5inner5outerAcA5PointV_AGtcfc", - "kind": "initializer", - "path": "Ring.init(inner:outer:)", - "name": "init(inner:outer:)", + "id": "s:9SwiftDemo3JobO", + "kind": "enum", + "path": "Job", + "name": "Job", "access": "public", - "declaration": "init(inner: Point, outer: Point)", + "declaration": "enum Job", + "location": "file://Sources/SwiftDemo/Values.swift:155:12", + "graph": "SwiftDemo.symbols.json", + "members": [ + "s:9SwiftDemo3JobO3runyACyyccACmF", + "s:9SwiftDemo3JobO4idleyA2CmF", + "s:9SwiftDemo3JobO6TicketV" + ] + }, + { + "id": "s:9SwiftDemo3JobO3runyACyyccACmF", + "kind": "enumCase", + "path": "Job.run(_:)", + "name": "run(_:)", + "access": "public", + "declaration": "case run(() -> Void)", + "parameters": [ + { + "type": { + "spelling": "() -> Void", + "references": [ + "s:s4Voida" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:156:9", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo3JobO" + }, + { + "id": "s:9SwiftDemo3JobO4idleyA2CmF", + "kind": "enumCase", + "path": "Job.idle", + "name": "idle", + "access": "public", + "declaration": "case idle", + "location": "file://Sources/SwiftDemo/Values.swift:157:9", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo3JobO" + }, + { + "id": "s:9SwiftDemo3JobO6TicketV", + "kind": "struct", + "path": "Job.Ticket", + "name": "Ticket", + "access": "public", + "declaration": "struct Ticket", + "location": "file://Sources/SwiftDemo/Values.swift:159:18", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo3JobO", + "members": [ + "s:9SwiftDemo3JobO6TicketV2idSivp", + "s:9SwiftDemo3JobO6TicketV2idAESi_tcfc" + ] + }, + { + "id": "s:9SwiftDemo3JobO6TicketV2idAESi_tcfc", + "kind": "initializer", + "path": "Job.Ticket.init(id:)", + "name": "init(id:)", + "access": "public", + "declaration": "init(id: Int)", + "parameters": [ + { + "label": "id", + "internalName": "id", + "type": { + "spelling": "Int", + "references": [ + "s:Si" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:161:15", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo3JobO6TicketV" + }, + { + "id": "s:9SwiftDemo3JobO6TicketV2idSivp", + "kind": "instanceProperty", + "path": "Job.Ticket.id", + "name": "id", + "access": "public", + "declaration": "var id: Int", + "valueType": { + "spelling": "Int", + "references": [ + "s:Si" + ] + }, + "settable": true, + "location": "file://Sources/SwiftDemo/Values.swift:160:19", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo3JobO6TicketV" + }, + { + "id": "s:9SwiftDemo4NoteC4textACSS_tcfc", + "kind": "initializer", + "path": "Note.init(text:)", + "name": "init(text:)", + "access": "public", + "declaration": "init(text: String)", + "parameters": [ + { + "label": "text", + "internalName": "text", + "type": { + "spelling": "String", + "references": [ + "s:SS" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Views.swift:19:11", + "graph": "SwiftDemo.symbols.json", + "parent": "c:@M@SwiftDemo@objc(cs)Note" + }, + { + "id": "s:9SwiftDemo4NoteC4textSSvp", + "kind": "instanceProperty", + "path": "Note.text", + "name": "text", + "access": "public", + "declaration": "let text: String", + "valueType": { + "spelling": "String", + "references": [ + "s:SS" + ] + }, + "settable": false, + "let": true, + "location": "file://Sources/SwiftDemo/Views.swift:18:15", + "graph": "SwiftDemo.symbols.json", + "parent": "c:@M@SwiftDemo@objc(cs)Note" + }, + { + "id": "s:9SwiftDemo4RingV", + "kind": "struct", + "path": "Ring", + "name": "Ring", + "access": "public", + "declaration": "struct Ring", + "location": "file://Sources/SwiftDemo/Shapes.swift:76:14", + "graph": "SwiftDemo.symbols.json", + "members": [ + "s:9SwiftDemo4RingV5innerAA5PointVvp", + "s:9SwiftDemo4RingV5outerAA5PointVvp", + "s:9SwiftDemo4RingV5inner5outerAcA5PointV_AGtcfc", + "s:9SwiftDemo4RingV6expand2byySd_tF", + "s:9SwiftDemo4RingV1poiyA2C_ACtFZ" + ] + }, + { + "id": "s:9SwiftDemo4RingV1poiyA2C_ACtFZ", + "kind": "operator", + "path": "Ring.+(_:_:)", + "name": "+(_:_:)", + "access": "public", + "declaration": "static func + (lhs: Ring, rhs: Ring) -> Ring", + "modifiers": [ + "static" + ], + "static": true, + "parameters": [ + { + "internalName": "lhs", + "type": { + "spelling": "Ring", + "references": [ + "s:9SwiftDemo4RingV" + ] + } + }, + { + "internalName": "rhs", + "type": { + "spelling": "Ring", + "references": [ + "s:9SwiftDemo4RingV" + ] + } + } + ], + "returns": { + "spelling": "Ring", + "references": [ + "s:9SwiftDemo4RingV" + ] + }, + "location": "file://Sources/SwiftDemo/Shapes.swift:90:23", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo4RingV" + }, + { + "id": "s:9SwiftDemo4RingV5inner5outerAcA5PointV_AGtcfc", + "kind": "initializer", + "path": "Ring.init(inner:outer:)", + "name": "init(inner:outer:)", + "access": "public", + "declaration": "init(inner: Point, outer: Point)", "parameters": [ { "label": "inner", @@ -818,103 +1319,290 @@ "parent": "s:9SwiftDemo4RingV" }, { - "id": "s:9SwiftDemo5PointV", - "kind": "struct", - "path": "Point", - "name": "Point", + "id": "s:9SwiftDemo4area2ofSdAA11MeasurementO_tF", + "kind": "function", + "path": "area(of:)", + "name": "area(of:)", "access": "public", - "declaration": "struct Point", - "location": "file://Sources/SwiftDemo/Demo.swift:9:14", - "graph": "SwiftDemo.symbols.json", - "members": [ - "s:9SwiftDemo5PointV1xSdvp", - "s:9SwiftDemo5PointV1ySdvp", - "s:9SwiftDemo5PointV1x1yACSd_Sdtcfc", - "s:9SwiftDemo5PointV11descriptionSSvp", - "s:9SwiftDemo5PointV6lengthSdvp" + "declaration": "func area(of measurement: Measurement) -> Double", + "parameters": [ + { + "label": "of", + "internalName": "measurement", + "type": { + "spelling": "Measurement", + "references": [ + "s:9SwiftDemo11MeasurementO" + ] + } + } ], - "conformances": [ - "s:s23CustomStringConvertibleP", - "s:s8CopyableP", - "s:s9EscapableP" - ] - }, - { - "id": "s:9SwiftDemo5PointV11descriptionSSvp", - "kind": "instanceProperty", - "path": "Point.description", - "name": "description", - "access": "public", - "declaration": "var description: String { get }", - "valueType": { - "spelling": "String", + "returns": { + "spelling": "Double", "references": [ - "s:SS" + "s:Sd" ] }, - "settable": false, - "extension": { - "extendedModule": "SwiftDemo", - "typeKind": "swift.struct" - }, - "location": "file://Sources/SwiftDemo/Extensions.swift:9:15", - "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo5PointV", - "sourceOrigin": "s:s23CustomStringConvertibleP11descriptionSSvp" + "location": "file://Sources/SwiftDemo/Values.swift:99:12", + "graph": "SwiftDemo.symbols.json" }, { - "id": "s:9SwiftDemo5PointV1x1yACSd_Sdtcfc", - "kind": "initializer", - "path": "Point.init(x:y:)", - "name": "init(x:y:)", + "id": "s:9SwiftDemo4bumpyySizF", + "kind": "function", + "path": "bump(_:)", + "name": "bump(_:)", "access": "public", - "declaration": "init(x: Double, y: Double)", + "declaration": "func bump(_ value: inout Int)", "parameters": [ { - "label": "x", - "internalName": "x", + "internalName": "value", "type": { - "spelling": "Double", + "spelling": "Int", "references": [ - "s:Sd" + "s:Si" ] - } - }, + }, + "modifier": "inout" + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:165:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo4echoyAA7PayloadOADF", + "kind": "function", + "path": "echo(_:)", + "name": "echo(_:)", + "access": "public", + "declaration": "func echo(_ payload: Payload) -> Payload", + "parameters": [ { - "label": "y", - "internalName": "y", + "internalName": "payload", "type": { - "spelling": "Double", + "spelling": "Payload", "references": [ - "s:Sd" + "s:9SwiftDemo7PayloadO" ] } } ], - "location": "file://Sources/SwiftDemo/Demo.swift:12:11", - "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo5PointV" - }, - { - "id": "s:9SwiftDemo5PointV1xSdvp", - "kind": "instanceProperty", - "path": "Point.x", - "name": "x", - "access": "public", - "declaration": "var x: Double", - "valueType": { - "spelling": "Double", + "returns": { + "spelling": "Payload", "references": [ - "s:Sd" + "s:9SwiftDemo7PayloadO" ] }, - "settable": true, - "location": "file://Sources/SwiftDemo/Demo.swift:10:15", - "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo5PointV" + "location": "file://Sources/SwiftDemo/Values.swift:152:12", + "graph": "SwiftDemo.symbols.json" }, { - "id": "s:9SwiftDemo5PointV1ySdvp", + "id": "s:9SwiftDemo4host2ofSSSg10Foundation3URLV_tF", + "kind": "function", + "path": "host(of:)", + "name": "host(of:)", + "access": "public", + "declaration": "func host(of url: URL) -> String?", + "parameters": [ + { + "label": "of", + "internalName": "url", + "type": { + "spelling": "URL", + "references": [ + "s:10Foundation3URLV" + ] + } + } + ], + "returns": { + "spelling": "String?", + "references": [ + "s:SS" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:65:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo4rampy10Foundation4DataVSiF", + "kind": "function", + "path": "ramp(_:)", + "name": "ramp(_:)", + "access": "public", + "declaration": "func ramp(_ count: Int) -> Data", + "parameters": [ + { + "internalName": "count", + "type": { + "spelling": "Int", + "references": [ + "s:Si" + ] + } + } + ], + "returns": { + "spelling": "Data", + "references": [ + "s:10Foundation4DataV" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:68:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo4tagsySaySiGSaySo6UIViewCGF", + "kind": "function", + "path": "tags(_:)", + "name": "tags(_:)", + "access": "public", + "declaration": "func tags(_ views: [UIView]) -> [Int]", + "parameters": [ + { + "internalName": "views", + "type": { + "spelling": "[UIView]", + "references": [ + "c:objc(cs)UIView" + ] + } + } + ], + "returns": { + "spelling": "[Int]", + "references": [ + "s:Si" + ] + }, + "location": "file://Sources/SwiftDemo/Views.swift:13:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo4text2ofSSAA4NoteC_tF", + "kind": "function", + "path": "text(of:)", + "name": "text(of:)", + "access": "public", + "declaration": "func text(of note: Note) -> String", + "parameters": [ + { + "label": "of", + "internalName": "note", + "type": { + "spelling": "Note", + "references": [ + "c:@M@SwiftDemo@objc(cs)Note" + ] + } + } + ], + "returns": { + "spelling": "String", + "references": [ + "s:SS" + ] + }, + "location": "file://Sources/SwiftDemo/Views.swift:23:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo5PointV", + "kind": "struct", + "path": "Point", + "name": "Point", + "access": "public", + "declaration": "struct Point", + "location": "file://Sources/SwiftDemo/Demo.swift:9:14", + "graph": "SwiftDemo.symbols.json", + "members": [ + "s:9SwiftDemo5PointV1xSdvp", + "s:9SwiftDemo5PointV1ySdvp", + "s:9SwiftDemo5PointV1x1yACSd_Sdtcfc", + "s:9SwiftDemo5PointV11descriptionSSvp", + "s:9SwiftDemo5PointV6lengthSdvp" + ], + "conformances": [ + "s:s23CustomStringConvertibleP", + "s:s8CopyableP", + "s:s9EscapableP" + ] + }, + { + "id": "s:9SwiftDemo5PointV11descriptionSSvp", + "kind": "instanceProperty", + "path": "Point.description", + "name": "description", + "access": "public", + "declaration": "var description: String { get }", + "valueType": { + "spelling": "String", + "references": [ + "s:SS" + ] + }, + "settable": false, + "extension": { + "extendedModule": "SwiftDemo", + "typeKind": "swift.struct" + }, + "location": "file://Sources/SwiftDemo/Extensions.swift:9:15", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo5PointV", + "sourceOrigin": "s:s23CustomStringConvertibleP11descriptionSSvp" + }, + { + "id": "s:9SwiftDemo5PointV1x1yACSd_Sdtcfc", + "kind": "initializer", + "path": "Point.init(x:y:)", + "name": "init(x:y:)", + "access": "public", + "declaration": "init(x: Double, y: Double)", + "parameters": [ + { + "label": "x", + "internalName": "x", + "type": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + } + }, + { + "label": "y", + "internalName": "y", + "type": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Demo.swift:12:11", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo5PointV" + }, + { + "id": "s:9SwiftDemo5PointV1xSdvp", + "kind": "instanceProperty", + "path": "Point.x", + "name": "x", + "access": "public", + "declaration": "var x: Double", + "valueType": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + }, + "settable": true, + "location": "file://Sources/SwiftDemo/Demo.swift:10:15", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo5PointV" + }, + { + "id": "s:9SwiftDemo5PointV1ySdvp", "kind": "instanceProperty", "path": "Point.y", "name": "y", @@ -1013,12 +1701,12 @@ "parent": "s:9SwiftDemo5ShapeP" }, { - "id": "s:9SwiftDemo5shoutySSSgACF", + "id": "s:9SwiftDemo5clearyySSSgzF", "kind": "function", - "path": "shout(_:)", - "name": "shout(_:)", + "path": "clear(_:)", + "name": "clear(_:)", "access": "public", - "declaration": "func shout(_ name: String?) -> String?", + "declaration": "func clear(_ name: inout String?)", "parameters": [ { "internalName": "name", @@ -1027,77 +1715,176 @@ "references": [ "s:SS" ] - } + }, + "modifier": "inout" } ], - "returns": { - "spelling": "String?", - "references": [ - "s:SS" - ] - }, - "location": "file://Sources/SwiftDemo/Values.swift:11:12", + "location": "file://Sources/SwiftDemo/Values.swift:171:12", "graph": "SwiftDemo.symbols.json" }, { - "id": "s:9SwiftDemo6CanvasC", - "kind": "class", - "path": "Canvas", - "name": "Canvas", + "id": "s:9SwiftDemo5halveyySizKF", + "kind": "function", + "path": "halve(_:)", + "name": "halve(_:)", "access": "public", - "declaration": "@MainActor final class Canvas", - "attributes": [ - "@MainActor" - ], - "modifiers": [ - "final" - ], - "location": "file://Sources/SwiftDemo/Shapes.swift:106:19", - "graph": "SwiftDemo.symbols.json", - "members": [ - "s:9SwiftDemo6CanvasCACycfc", - "s:9SwiftDemo6CanvasC4drawyyAA5Shape_pF" + "declaration": "func halve(_ value: inout Int) throws", + "parameters": [ + { + "internalName": "value", + "type": { + "spelling": "Int", + "references": [ + "s:Si" + ] + }, + "modifier": "inout" + } ], - "conformances": [ - "s:s8SendableP" - ] + "throws": true, + "location": "file://Sources/SwiftDemo/Values.swift:167:12", + "graph": "SwiftDemo.symbols.json" }, { - "id": "s:9SwiftDemo6CanvasC4drawyyAA5Shape_pF", - "kind": "instanceMethod", - "path": "Canvas.draw(_:)", - "name": "draw(_:)", + "id": "s:9SwiftDemo5namesySaySSGSiF", + "kind": "function", + "path": "names(_:)", + "name": "names(_:)", "access": "public", - "declaration": "@MainActor func draw(_ shape: any Shape)", - "attributes": [ - "@MainActor" - ], + "declaration": "func names(_ count: Int) -> [String]", "parameters": [ { - "internalName": "shape", + "internalName": "count", "type": { - "spelling": "any Shape", + "spelling": "Int", "references": [ - "s:9SwiftDemo5ShapeP" + "s:Si" ] } } ], - "location": "file://Sources/SwiftDemo/Shapes.swift:108:16", - "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo6CanvasC" + "returns": { + "spelling": "[String]", + "references": [ + "s:SS" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:54:12", + "graph": "SwiftDemo.symbols.json" }, { - "id": "s:9SwiftDemo6CanvasCACycfc", - "kind": "initializer", - "path": "Canvas.init()", - "name": "init()", - "access": "public", - "declaration": "@MainActor init()", - "attributes": [ + "id": "s:9SwiftDemo5shoutySSSgACF", + "kind": "function", + "path": "shout(_:)", + "name": "shout(_:)", + "access": "public", + "declaration": "func shout(_ name: String?) -> String?", + "parameters": [ + { + "internalName": "name", + "type": { + "spelling": "String?", + "references": [ + "s:SS" + ] + } + } + ], + "returns": { + "spelling": "String?", + "references": [ + "s:SS" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:13:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo5totalySdSaySdGF", + "kind": "function", + "path": "total(_:)", + "name": "total(_:)", + "access": "public", + "declaration": "func total(_ values: [Double]) -> Double", + "parameters": [ + { + "internalName": "values", + "type": { + "spelling": "[Double]", + "references": [ + "s:Sd" + ] + } + } + ], + "returns": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:55:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo6CanvasC", + "kind": "class", + "path": "Canvas", + "name": "Canvas", + "access": "public", + "declaration": "@MainActor final class Canvas", + "attributes": [ + "@MainActor" + ], + "modifiers": [ + "final" + ], + "location": "file://Sources/SwiftDemo/Shapes.swift:107:19", + "graph": "SwiftDemo.symbols.json", + "members": [ + "s:9SwiftDemo6CanvasCACycfc", + "s:9SwiftDemo6CanvasC4drawyyAA5Shape_pF" + ], + "conformances": [ + "s:s8SendableP" + ] + }, + { + "id": "s:9SwiftDemo6CanvasC4drawyyAA5Shape_pF", + "kind": "instanceMethod", + "path": "Canvas.draw(_:)", + "name": "draw(_:)", + "access": "public", + "declaration": "@MainActor func draw(_ shape: any Shape)", + "attributes": [ + "@MainActor" + ], + "parameters": [ + { + "internalName": "shape", + "type": { + "spelling": "any Shape", + "references": [ + "s:9SwiftDemo5ShapeP" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Shapes.swift:109:16", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo6CanvasC" + }, + { + "id": "s:9SwiftDemo6CanvasCACycfc", + "kind": "initializer", + "path": "Canvas.init()", + "name": "init()", + "access": "public", + "declaration": "@MainActor init()", + "attributes": [ "@MainActor" ], - "location": "file://Sources/SwiftDemo/Shapes.swift:107:11", + "location": "file://Sources/SwiftDemo/Shapes.swift:108:11", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6CanvasC" }, @@ -1116,6 +1903,8 @@ "s:9SwiftDemo6FlavorO11descriptionSSvp", "s:9SwiftDemo6FlavorO8rawValueACSgSi_tcfc", "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO", + "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo6FlavorO", + "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO", "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo6FlavorO", "s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo6FlavorO" ], @@ -1207,7 +1996,7 @@ "modifiers": [ "final" ], - "location": "file://Sources/SwiftDemo/Shapes.swift:111:19", + "location": "file://Sources/SwiftDemo/Shapes.swift:112:19", "graph": "SwiftDemo.symbols.json", "members": [ "s:9SwiftDemo6LoaderCACycfc", @@ -1238,7 +2027,7 @@ "introduced": "16.0.0" } ], - "location": "file://Sources/SwiftDemo/Shapes.swift:129:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:130:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1256,7 +2045,7 @@ "unconditionallyDeprecated": true } ], - "location": "file://Sources/SwiftDemo/Shapes.swift:132:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:133:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1284,7 +2073,7 @@ ] } ], - "location": "file://Sources/SwiftDemo/Shapes.swift:121:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:122:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1307,7 +2096,7 @@ } } ], - "location": "file://Sources/SwiftDemo/Shapes.swift:122:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:123:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1337,7 +2126,7 @@ ] }, "throws": true, - "location": "file://Sources/SwiftDemo/Shapes.swift:114:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:115:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1361,7 +2150,7 @@ } ], "async": true, - "location": "file://Sources/SwiftDemo/Shapes.swift:116:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:117:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1392,7 +2181,7 @@ }, "async": true, "throws": true, - "location": "file://Sources/SwiftDemo/Shapes.swift:115:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:116:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1425,7 +2214,7 @@ "index": 0 } ], - "location": "file://Sources/SwiftDemo/Shapes.swift:119:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:120:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1465,7 +2254,7 @@ "s:Si" ] }, - "location": "file://Sources/SwiftDemo/Shapes.swift:124:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:125:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1488,7 +2277,7 @@ "modifier": "inout" } ], - "location": "file://Sources/SwiftDemo/Shapes.swift:126:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:127:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1507,7 +2296,7 @@ "renamed": "fetch(url:)" } ], - "location": "file://Sources/SwiftDemo/Shapes.swift:135:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:136:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1547,7 +2336,7 @@ "rhsPrecise": "s:9SwiftDemo5ShapeP" } ], - "location": "file://Sources/SwiftDemo/Shapes.swift:118:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:119:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1558,7 +2347,7 @@ "name": "init()", "access": "public", "declaration": "init()", - "location": "file://Sources/SwiftDemo/Shapes.swift:112:11", + "location": "file://Sources/SwiftDemo/Shapes.swift:113:11", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo6LoaderC" }, @@ -1728,6 +2517,38 @@ "parent": "s:9SwiftDemo6SquareC", "sourceOrigin": "s:9SwiftDemo5ShapeP5sidesSivpZ" }, + { + "id": "s:9SwiftDemo6append_2toySS_SaySSGztF", + "kind": "function", + "path": "append(_:to:)", + "name": "append(_:to:)", + "access": "public", + "declaration": "func append(_ word: String, to words: inout [String])", + "parameters": [ + { + "internalName": "word", + "type": { + "spelling": "String", + "references": [ + "s:SS" + ] + } + }, + { + "label": "to", + "internalName": "words", + "type": { + "spelling": "[String]", + "references": [ + "s:SS" + ] + }, + "modifier": "inout" + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:166:12", + "graph": "SwiftDemo.symbols.json" + }, { "id": "s:9SwiftDemo7CounterC", "kind": "actor", @@ -1739,6 +2560,7 @@ "graph": "SwiftDemo.symbols.json", "members": [ "s:9SwiftDemo7CounterC5valueSivp", + "s:9SwiftDemo7CounterC4stepSivp", "s:9SwiftDemo7CounterCACycfc", "s:9SwiftDemo7CounterC9incrementSiyF", "s:9SwiftDemo7CounterC5labelSSyF", @@ -1754,6 +2576,24 @@ "s:s8SendableP" ] }, + { + "id": "s:9SwiftDemo7CounterC4stepSivp", + "kind": "instanceProperty", + "path": "Counter.step", + "name": "step", + "access": "public", + "declaration": "var step: Int", + "valueType": { + "spelling": "Int", + "references": [ + "s:Si" + ] + }, + "settable": true, + "location": "file://Sources/SwiftDemo/Shapes.swift:97:15", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7CounterC" + }, { "id": "s:9SwiftDemo7CounterC5labelSSyF", "kind": "instanceMethod", @@ -1770,7 +2610,7 @@ "s:SS" ] }, - "location": "file://Sources/SwiftDemo/Shapes.swift:102:28", + "location": "file://Sources/SwiftDemo/Shapes.swift:103:28", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo7CounterC" }, @@ -1805,7 +2645,7 @@ "s:Si" ] }, - "location": "file://Sources/SwiftDemo/Shapes.swift:98:16", + "location": "file://Sources/SwiftDemo/Shapes.swift:99:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo7CounterC" }, @@ -1816,10 +2656,118 @@ "name": "init()", "access": "public", "declaration": "init()", - "location": "file://Sources/SwiftDemo/Shapes.swift:97:11", + "location": "file://Sources/SwiftDemo/Shapes.swift:98:11", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo7CounterC" }, + { + "id": "s:9SwiftDemo7FormulaO", + "kind": "enum", + "path": "Formula", + "name": "Formula", + "access": "public", + "declaration": "indirect enum Formula", + "modifiers": [ + "indirect" + ], + "location": "file://Sources/SwiftDemo/Values.swift:128:21", + "graph": "SwiftDemo.symbols.json", + "members": [ + "s:9SwiftDemo7FormulaO6numberyACSdcACmF", + "s:9SwiftDemo7FormulaO3sumyA2C_ACtcACmF", + "s:9SwiftDemo7FormulaO6negateyA2CcACmF", + "s:9SwiftDemo7FormulaO5valueSdvp" + ] + }, + { + "id": "s:9SwiftDemo7FormulaO3sumyA2C_ACtcACmF", + "kind": "enumCase", + "path": "Formula.sum(_:_:)", + "name": "sum(_:_:)", + "access": "public", + "declaration": "case sum(Formula, Formula)", + "parameters": [ + { + "type": { + "spelling": "Formula", + "references": [ + "s:9SwiftDemo7FormulaO" + ] + } + }, + { + "type": { + "spelling": "Formula", + "references": [ + "s:9SwiftDemo7FormulaO" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:130:9", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7FormulaO" + }, + { + "id": "s:9SwiftDemo7FormulaO5valueSdvp", + "kind": "instanceProperty", + "path": "Formula.value", + "name": "value", + "access": "public", + "declaration": "var value: Double { get }", + "valueType": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + }, + "settable": false, + "location": "file://Sources/SwiftDemo/Values.swift:133:15", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7FormulaO" + }, + { + "id": "s:9SwiftDemo7FormulaO6negateyA2CcACmF", + "kind": "enumCase", + "path": "Formula.negate(_:)", + "name": "negate(_:)", + "access": "public", + "declaration": "case negate(Formula)", + "parameters": [ + { + "type": { + "spelling": "Formula", + "references": [ + "s:9SwiftDemo7FormulaO" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:131:9", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7FormulaO" + }, + { + "id": "s:9SwiftDemo7FormulaO6numberyACSdcACmF", + "kind": "enumCase", + "path": "Formula.number(_:)", + "name": "number(_:)", + "access": "public", + "declaration": "case number(Double)", + "parameters": [ + { + "type": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:129:9", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7FormulaO" + }, { "id": "s:9SwiftDemo7GreeterP", "kind": "protocol", @@ -1864,49 +2812,276 @@ "parent": "s:9SwiftDemo7GreeterP" }, { - "id": "s:9SwiftDemo7PolygonC", + "id": "s:9SwiftDemo7PaletteC", "kind": "class", - "path": "Polygon", - "name": "Polygon", - "access": "open", - "declaration": "class Polygon", - "location": "file://Sources/SwiftDemo/Shapes.swift:7:11", + "path": "Palette", + "name": "Palette", + "access": "public", + "declaration": "@MainActor final class Palette", + "attributes": [ + "@MainActor" + ], + "modifiers": [ + "final" + ], + "location": "file://Sources/SwiftDemo/Values.swift:41:19", "graph": "SwiftDemo.symbols.json", "members": [ - "s:9SwiftDemo7PolygonC4nameSSvp", - "s:9SwiftDemo7PolygonC11vertexCountSivp", - "s:9SwiftDemo7PolygonC6sharedACvpZ", - "s:9SwiftDemo7PolygonC4name11vertexCountACSS_Sitcfc", - "s:9SwiftDemo7PolygonC4nameACSgSS_tcfc", - "s:9SwiftDemo7PolygonC5scale2byySd_tF", - "s:9SwiftDemo7PolygonC5scale2byySi_tF", - "s:9SwiftDemo7PolygonC5scale1x1yySd_SdtF", - "s:9SwiftDemo7PolygonC4makeACyFZ", - "s:9SwiftDemo7PolygonC8describeySSACSgFZ", - "s:9SwiftDemo7PolygonCyAA5PointVSicip" + "s:9SwiftDemo7PaletteC7strokesSivp", + "s:9SwiftDemo7PaletteCACycfc", + "s:9SwiftDemo7PaletteC6strokeSiyF", + "s:9SwiftDemo7PaletteC11strokeLaterSiyYaF" + ], + "conformances": [ + "s:s8SendableP" ] }, { - "id": "s:9SwiftDemo7PolygonC11vertexCountSivp", - "kind": "instanceProperty", - "path": "Polygon.vertexCount", - "name": "vertexCount", + "id": "s:9SwiftDemo7PaletteC11strokeLaterSiyYaF", + "kind": "instanceMethod", + "path": "Palette.strokeLater()", + "name": "strokeLater()", "access": "public", - "declaration": "var vertexCount: Int { get }", - "valueType": { + "declaration": "@MainActor func strokeLater() async -> Int", + "attributes": [ + "@MainActor" + ], + "returns": { "spelling": "Int", "references": [ "s:Si" ] }, - "settable": false, - "location": "file://Sources/SwiftDemo/Shapes.swift:9:28", + "async": true, + "location": "file://Sources/SwiftDemo/Values.swift:48:16", "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo7PolygonC" + "parent": "s:9SwiftDemo7PaletteC" }, { - "id": "s:9SwiftDemo7PolygonC4makeACyFZ", - "kind": "typeMethod", + "id": "s:9SwiftDemo7PaletteC6strokeSiyF", + "kind": "instanceMethod", + "path": "Palette.stroke()", + "name": "stroke()", + "access": "public", + "declaration": "@MainActor func stroke() -> Int", + "attributes": [ + "@MainActor" + ], + "returns": { + "spelling": "Int", + "references": [ + "s:Si" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:44:16", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PaletteC" + }, + { + "id": "s:9SwiftDemo7PaletteC7strokesSivp", + "kind": "instanceProperty", + "path": "Palette.strokes", + "name": "strokes", + "access": "public", + "declaration": "@MainActor var strokes: Int { get }", + "attributes": [ + "@MainActor" + ], + "valueType": { + "spelling": "Int", + "references": [ + "s:Si" + ] + }, + "settable": false, + "location": "file://Sources/SwiftDemo/Values.swift:42:28", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PaletteC" + }, + { + "id": "s:9SwiftDemo7PaletteCACycfc", + "kind": "initializer", + "path": "Palette.init()", + "name": "init()", + "access": "public", + "declaration": "@MainActor init()", + "attributes": [ + "@MainActor" + ], + "location": "file://Sources/SwiftDemo/Values.swift:43:11", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PaletteC" + }, + { + "id": "s:9SwiftDemo7PayloadO", + "kind": "enum", + "path": "Payload", + "name": "Payload", + "access": "public", + "declaration": "enum Payload", + "location": "file://Sources/SwiftDemo/Values.swift:144:12", + "graph": "SwiftDemo.symbols.json", + "members": [ + "s:9SwiftDemo7PayloadO7trackeryAcA7TrackerCcACmF", + "s:9SwiftDemo7PayloadO5pointyAcA5PointVcACmF", + "s:9SwiftDemo7PayloadO6flavoryAcA6FlavorOcACmF", + "s:9SwiftDemo7PayloadO5maybeyACSiSgcACmF", + "s:9SwiftDemo7PayloadO5namesyACSaySSGcACmF" + ] + }, + { + "id": "s:9SwiftDemo7PayloadO5maybeyACSiSgcACmF", + "kind": "enumCase", + "path": "Payload.maybe(_:)", + "name": "maybe(_:)", + "access": "public", + "declaration": "case maybe(Int?)", + "parameters": [ + { + "type": { + "spelling": "Int?", + "references": [ + "s:Si" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:148:9", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PayloadO" + }, + { + "id": "s:9SwiftDemo7PayloadO5namesyACSaySSGcACmF", + "kind": "enumCase", + "path": "Payload.names(_:)", + "name": "names(_:)", + "access": "public", + "declaration": "case names([String])", + "parameters": [ + { + "type": { + "spelling": "[String]", + "references": [ + "s:SS" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:149:9", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PayloadO" + }, + { + "id": "s:9SwiftDemo7PayloadO5pointyAcA5PointVcACmF", + "kind": "enumCase", + "path": "Payload.point(_:)", + "name": "point(_:)", + "access": "public", + "declaration": "case point(Point)", + "parameters": [ + { + "type": { + "spelling": "Point", + "references": [ + "s:9SwiftDemo5PointV" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:146:9", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PayloadO" + }, + { + "id": "s:9SwiftDemo7PayloadO6flavoryAcA6FlavorOcACmF", + "kind": "enumCase", + "path": "Payload.flavor(_:)", + "name": "flavor(_:)", + "access": "public", + "declaration": "case flavor(Flavor)", + "parameters": [ + { + "type": { + "spelling": "Flavor", + "references": [ + "s:9SwiftDemo6FlavorO" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:147:9", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PayloadO" + }, + { + "id": "s:9SwiftDemo7PayloadO7trackeryAcA7TrackerCcACmF", + "kind": "enumCase", + "path": "Payload.tracker(_:)", + "name": "tracker(_:)", + "access": "public", + "declaration": "case tracker(Tracker)", + "parameters": [ + { + "type": { + "spelling": "Tracker", + "references": [ + "s:9SwiftDemo7TrackerC" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:145:9", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PayloadO" + }, + { + "id": "s:9SwiftDemo7PolygonC", + "kind": "class", + "path": "Polygon", + "name": "Polygon", + "access": "open", + "declaration": "class Polygon", + "location": "file://Sources/SwiftDemo/Shapes.swift:7:11", + "graph": "SwiftDemo.symbols.json", + "members": [ + "s:9SwiftDemo7PolygonC5StyleO", + "s:9SwiftDemo7PolygonC7MetricsV", + "s:9SwiftDemo7PolygonC5styleAC5StyleOvp", + "s:9SwiftDemo7PolygonC7metrics4sideAC7MetricsVSd_tF", + "s:9SwiftDemo7PolygonC4nameSSvp", + "s:9SwiftDemo7PolygonC11vertexCountSivp", + "s:9SwiftDemo7PolygonC6sharedACvpZ", + "s:9SwiftDemo7PolygonC4name11vertexCountACSS_Sitcfc", + "s:9SwiftDemo7PolygonC4nameACSgSS_tcfc", + "s:9SwiftDemo7PolygonC5scale2byySd_tF", + "s:9SwiftDemo7PolygonC5scale2byySi_tF", + "s:9SwiftDemo7PolygonC5scale1x1yySd_SdtF", + "s:9SwiftDemo7PolygonC4makeACyFZ", + "s:9SwiftDemo7PolygonC8describeySSACSgFZ", + "s:9SwiftDemo7PolygonCyAA5PointVSicip" + ] + }, + { + "id": "s:9SwiftDemo7PolygonC11vertexCountSivp", + "kind": "instanceProperty", + "path": "Polygon.vertexCount", + "name": "vertexCount", + "access": "public", + "declaration": "var vertexCount: Int { get }", + "valueType": { + "spelling": "Int", + "references": [ + "s:Si" + ] + }, + "settable": false, + "location": "file://Sources/SwiftDemo/Shapes.swift:9:28", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC" + }, + { + "id": "s:9SwiftDemo7PolygonC4makeACyFZ", + "kind": "typeMethod", "path": "Polygon.make()", "name": "make()", "access": "public", @@ -2004,6 +3179,82 @@ "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo7PolygonC" }, + { + "id": "s:9SwiftDemo7PolygonC5StyleO", + "kind": "enum", + "path": "Polygon.Style", + "name": "Style", + "access": "public", + "declaration": "enum Style", + "extension": { + "extendedModule": "SwiftDemo", + "typeKind": "swift.class" + }, + "location": "file://Sources/SwiftDemo/Extensions.swift:31:16", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC", + "members": [ + "s:9SwiftDemo7PolygonC5StyleO5solidyA2EmF", + "s:9SwiftDemo7PolygonC5StyleO6dashedyA2EmF", + "s:9SwiftDemo7PolygonC5StyleO8rawValueAESgSS_tcfc", + "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO" + ], + "conformances": [ + "s:SH", + "s:SQ", + "s:SY" + ] + }, + { + "id": "s:9SwiftDemo7PolygonC5StyleO5solidyA2EmF", + "kind": "enumCase", + "path": "Polygon.Style.solid", + "name": "solid", + "access": "public", + "declaration": "case solid", + "location": "file://Sources/SwiftDemo/Extensions.swift:31:37", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC5StyleO" + }, + { + "id": "s:9SwiftDemo7PolygonC5StyleO6dashedyA2EmF", + "kind": "enumCase", + "path": "Polygon.Style.dashed", + "name": "dashed", + "access": "public", + "declaration": "case dashed", + "location": "file://Sources/SwiftDemo/Extensions.swift:31:44", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC5StyleO" + }, + { + "id": "s:9SwiftDemo7PolygonC5StyleO8rawValueAESgSS_tcfc", + "kind": "initializer", + "path": "Polygon.Style.init(rawValue:)", + "name": "init(rawValue:)", + "access": "public", + "declaration": "init?(rawValue: String)", + "parameters": [ + { + "label": "rawValue", + "internalName": "rawValue", + "type": { + "spelling": "String", + "references": [ + "s:SS" + ] + } + } + ], + "failable": true, + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC5StyleO", + "sourceOrigin": "s:SY8rawValuexSg03RawB0Qz_tcfc" + }, { "id": "s:9SwiftDemo7PolygonC5scale1x1yySd_SdtF", "kind": "instanceMethod", @@ -2083,6 +3334,28 @@ "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo7PolygonC" }, + { + "id": "s:9SwiftDemo7PolygonC5styleAC5StyleOvp", + "kind": "instanceProperty", + "path": "Polygon.style", + "name": "style", + "access": "public", + "declaration": "var style: Style { get }", + "valueType": { + "spelling": "Style", + "references": [ + "s:9SwiftDemo7PolygonC5StyleO" + ] + }, + "settable": false, + "extension": { + "extendedModule": "SwiftDemo", + "typeKind": "swift.class" + }, + "location": "file://Sources/SwiftDemo/Extensions.swift:38:15", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC" + }, { "id": "s:9SwiftDemo7PolygonC6sharedACvpZ", "kind": "typeProperty", @@ -2107,40 +3380,134 @@ "parent": "s:9SwiftDemo7PolygonC" }, { - "id": "s:9SwiftDemo7PolygonC8describeySSACSgFZ", - "kind": "typeMethod", - "path": "Polygon.describe(_:)", - "name": "describe(_:)", + "id": "s:9SwiftDemo7PolygonC7MetricsV", + "kind": "struct", + "path": "Polygon.Metrics", + "name": "Metrics", "access": "public", - "declaration": "static func describe(_ polygon: Polygon?) -> String", - "modifiers": [ - "static" - ], - "static": true, + "declaration": "struct Metrics", + "extension": { + "extendedModule": "SwiftDemo", + "typeKind": "swift.class" + }, + "location": "file://Sources/SwiftDemo/Extensions.swift:33:18", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC", + "members": [ + "s:9SwiftDemo7PolygonC7MetricsV9perimeterSdvp", + "s:9SwiftDemo7PolygonC7MetricsV9perimeterAESd_tcfc" + ] + }, + { + "id": "s:9SwiftDemo7PolygonC7MetricsV9perimeterAESd_tcfc", + "kind": "initializer", + "path": "Polygon.Metrics.init(perimeter:)", + "name": "init(perimeter:)", + "access": "public", + "declaration": "init(perimeter: Double)", "parameters": [ { - "internalName": "polygon", + "label": "perimeter", + "internalName": "perimeter", "type": { - "spelling": "Polygon?", + "spelling": "Double", "references": [ - "s:9SwiftDemo7PolygonC" + "s:Sd" ] } } ], - "returns": { - "spelling": "String", - "references": [ - "s:SS" - ] - }, - "location": "file://Sources/SwiftDemo/Shapes.swift:27:23", + "location": "file://Sources/SwiftDemo/Extensions.swift:35:15", "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo7PolygonC" + "parent": "s:9SwiftDemo7PolygonC7MetricsV" }, { - "id": "s:9SwiftDemo7PolygonCyAA5PointVSicip", - "kind": "instanceSubscript", + "id": "s:9SwiftDemo7PolygonC7MetricsV9perimeterSdvp", + "kind": "instanceProperty", + "path": "Polygon.Metrics.perimeter", + "name": "perimeter", + "access": "public", + "declaration": "var perimeter: Double", + "valueType": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + }, + "settable": true, + "location": "file://Sources/SwiftDemo/Extensions.swift:34:19", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC7MetricsV" + }, + { + "id": "s:9SwiftDemo7PolygonC7metrics4sideAC7MetricsVSd_tF", + "kind": "instanceMethod", + "path": "Polygon.metrics(side:)", + "name": "metrics(side:)", + "access": "public", + "declaration": "func metrics(side: Double) -> Metrics", + "parameters": [ + { + "label": "side", + "internalName": "side", + "type": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + } + } + ], + "returns": { + "spelling": "Polygon.Metrics", + "references": [ + "s:9SwiftDemo7PolygonC", + "s:9SwiftDemo7PolygonC7MetricsV" + ] + }, + "extension": { + "extendedModule": "SwiftDemo", + "typeKind": "swift.class" + }, + "location": "file://Sources/SwiftDemo/Extensions.swift:39:16", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC" + }, + { + "id": "s:9SwiftDemo7PolygonC8describeySSACSgFZ", + "kind": "typeMethod", + "path": "Polygon.describe(_:)", + "name": "describe(_:)", + "access": "public", + "declaration": "static func describe(_ polygon: Polygon?) -> String", + "modifiers": [ + "static" + ], + "static": true, + "parameters": [ + { + "internalName": "polygon", + "type": { + "spelling": "Polygon?", + "references": [ + "s:9SwiftDemo7PolygonC" + ] + } + } + ], + "returns": { + "spelling": "String", + "references": [ + "s:SS" + ] + }, + "location": "file://Sources/SwiftDemo/Shapes.swift:27:23", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC" + }, + { + "id": "s:9SwiftDemo7PolygonCyAA5PointVSicip", + "kind": "instanceSubscript", "path": "Polygon.subscript(_:)", "name": "subscript(_:)", "access": "public", @@ -2183,7 +3550,7 @@ "modifiers": [ "final" ], - "location": "file://Sources/SwiftDemo/Values.swift:13:19", + "location": "file://Sources/SwiftDemo/Values.swift:15:19", "graph": "SwiftDemo.symbols.json", "members": [ "s:9SwiftDemo7TrackerC9liveCountSivpZ", @@ -2211,7 +3578,7 @@ } } ], - "location": "file://Sources/SwiftDemo/Values.swift:17:11", + "location": "file://Sources/SwiftDemo/Values.swift:19:11", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo7TrackerC" }, @@ -2230,7 +3597,7 @@ }, "settable": false, "let": true, - "location": "file://Sources/SwiftDemo/Values.swift:15:15", + "location": "file://Sources/SwiftDemo/Values.swift:17:15", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo7TrackerC" }, @@ -2247,7 +3614,7 @@ "s:9SwiftDemo7TrackerC" ] }, - "location": "file://Sources/SwiftDemo/Values.swift:24:16", + "location": "file://Sources/SwiftDemo/Values.swift:26:16", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo7TrackerC" }, @@ -2269,44 +3636,1020 @@ ] }, "settable": false, - "location": "file://Sources/SwiftDemo/Values.swift:14:35", + "location": "file://Sources/SwiftDemo/Values.swift:16:35", "graph": "SwiftDemo.symbols.json", "parent": "s:9SwiftDemo7TrackerC" }, { - "id": "s:9SwiftDemo8echoInt8ys0D0VADF", + "id": "s:9SwiftDemo7explainySSAA10ShapeErrorOF", "kind": "function", - "path": "echoInt8(_:)", - "name": "echoInt8(_:)", + "path": "explain(_:)", + "name": "explain(_:)", "access": "public", - "declaration": "func echoInt8(_ value: Int8) -> Int8", + "declaration": "func explain(_ error: ShapeError) -> String", + "parameters": [ + { + "internalName": "error", + "type": { + "spelling": "ShapeError", + "references": [ + "s:9SwiftDemo10ShapeErrorO" + ] + } + } + ], + "returns": { + "spelling": "String", + "references": [ + "s:SS" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:120:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo7lengthsySDySSSiGSDyS2SGF", + "kind": "function", + "path": "lengths(_:)", + "name": "lengths(_:)", + "access": "public", + "declaration": "func lengths(_ table: [String : String]) -> [String : Int]", + "parameters": [ + { + "internalName": "table", + "type": { + "spelling": "[String : String]", + "references": [ + "s:SS", + "s:SS" + ] + } + } + ], + "returns": { + "spelling": "[String : Int]", + "references": [ + "s:SS", + "s:Si" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:61:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo7measure_2byAA11MeasurementOSd_SdSgtF", + "kind": "function", + "path": "measure(_:by:)", + "name": "measure(_:by:)", + "access": "public", + "declaration": "func measure(_ width: Double, by height: Double?) -> Measurement", + "parameters": [ + { + "internalName": "width", + "type": { + "spelling": "Double", + "references": [ + "s:Sd" + ] + } + }, + { + "label": "by", + "internalName": "height", + "type": { + "spelling": "Double?", + "references": [ + "s:Sd" + ] + } + } + ], + "returns": { + "spelling": "Measurement", + "references": [ + "s:9SwiftDemo11MeasurementO" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:106:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo7nextDay5after10Foundation4DateVAF_tF", + "kind": "function", + "path": "nextDay(after:)", + "name": "nextDay(after:)", + "access": "public", + "declaration": "func nextDay(after date: Date) -> Date", + "parameters": [ + { + "label": "after", + "internalName": "date", + "type": { + "spelling": "Date", + "references": [ + "s:10Foundation4DateV" + ] + } + } + ], + "returns": { + "spelling": "Date", + "references": [ + "s:10Foundation4DateV" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:64:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo7resolve_7against10Foundation3URLVSS_AFtF", + "kind": "function", + "path": "resolve(_:against:)", + "name": "resolve(_:against:)", + "access": "public", + "declaration": "func resolve(_ path: String, against base: URL) -> URL", + "parameters": [ + { + "internalName": "path", + "type": { + "spelling": "String", + "references": [ + "s:SS" + ] + } + }, + { + "label": "against", + "internalName": "base", + "type": { + "spelling": "URL", + "references": [ + "s:10Foundation3URLV" + ] + } + } + ], + "returns": { + "spelling": "URL", + "references": [ + "s:10Foundation3URLV" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:66:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo8NotifierC", + "kind": "class", + "path": "Notifier", + "name": "Notifier", + "access": "public", + "declaration": "final class Notifier", + "modifiers": [ + "final" + ], + "location": "file://Sources/SwiftDemo/Values.swift:86:19", + "graph": "SwiftDemo.symbols.json", + "members": [ + "s:9SwiftDemo8NotifierCACycfc", + "s:9SwiftDemo8NotifierC5countSivp", + "s:9SwiftDemo8NotifierC9subscribeyyySSYbcF", + "s:9SwiftDemo8NotifierC7publishyySSF", + "s:9SwiftDemo8NotifierC12publishLateryySSF", + "s:9SwiftDemo8NotifierC5clearyyF" + ], + "conformances": [ + "s:s16SendableMetatypeP", + "s:s8SendableP" + ] + }, + { + "id": "s:9SwiftDemo8NotifierC12publishLateryySSF", + "kind": "instanceMethod", + "path": "Notifier.publishLater(_:)", + "name": "publishLater(_:)", + "access": "public", + "declaration": "func publishLater(_ message: String)", + "parameters": [ + { + "internalName": "message", + "type": { + "spelling": "String", + "references": [ + "s:SS" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:92:16", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo8NotifierC" + }, + { + "id": "s:9SwiftDemo8NotifierC5clearyyF", + "kind": "instanceMethod", + "path": "Notifier.clear()", + "name": "clear()", + "access": "public", + "declaration": "func clear()", + "location": "file://Sources/SwiftDemo/Values.swift:96:16", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo8NotifierC" + }, + { + "id": "s:9SwiftDemo8NotifierC5countSivp", + "kind": "instanceProperty", + "path": "Notifier.count", + "name": "count", + "access": "public", + "declaration": "var count: Int { get }", + "valueType": { + "spelling": "Int", + "references": [ + "s:Si" + ] + }, + "settable": false, + "location": "file://Sources/SwiftDemo/Values.swift:89:15", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo8NotifierC" + }, + { + "id": "s:9SwiftDemo8NotifierC7publishyySSF", + "kind": "instanceMethod", + "path": "Notifier.publish(_:)", + "name": "publish(_:)", + "access": "public", + "declaration": "func publish(_ message: String)", + "parameters": [ + { + "internalName": "message", + "type": { + "spelling": "String", + "references": [ + "s:SS" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:91:16", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo8NotifierC" + }, + { + "id": "s:9SwiftDemo8NotifierC9subscribeyyySSYbcF", + "kind": "instanceMethod", + "path": "Notifier.subscribe(_:)", + "name": "subscribe(_:)", + "access": "public", + "declaration": "func subscribe(_ handler: @escaping @Sendable (String) -> Void)", + "parameters": [ + { + "internalName": "handler", + "type": { + "spelling": "(String) -> Void", + "references": [ + "s:SS", + "s:s4Voida" + ] + }, + "attributes": [ + "@escaping", + "@Sendable" + ] + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:90:16", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo8NotifierC" + }, + { + "id": "s:9SwiftDemo8NotifierCACycfc", + "kind": "initializer", + "path": "Notifier.init()", + "name": "init()", + "access": "public", + "declaration": "init()", + "location": "file://Sources/SwiftDemo/Values.swift:88:11", + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo8NotifierC" + }, + { + "id": "s:9SwiftDemo8centroid2ofAA5PointVSayAEG_tF", + "kind": "function", + "path": "centroid(of:)", + "name": "centroid(of:)", + "access": "public", + "declaration": "func centroid(of points: [Point]) -> Point", + "parameters": [ + { + "label": "of", + "internalName": "points", + "type": { + "spelling": "[Point]", + "references": [ + "s:9SwiftDemo5PointV" + ] + } + } + ], + "returns": { + "spelling": "Point", + "references": [ + "s:9SwiftDemo5PointV" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:56:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo8checksumySi10Foundation4DataVF", + "kind": "function", + "path": "checksum(_:)", + "name": "checksum(_:)", + "access": "public", + "declaration": "func checksum(_ data: Data) -> Int", + "parameters": [ + { + "internalName": "data", + "type": { + "spelling": "Data", + "references": [ + "s:10Foundation4DataV" + ] + } + } + ], + "returns": { + "spelling": "Int", + "references": [ + "s:Si" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:67:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo8describeySSSo6UIViewCF", + "kind": "function", + "path": "describe(_:)", + "name": "describe(_:)", + "access": "public", + "declaration": "func describe(_ view: UIView) -> String", + "parameters": [ + { + "internalName": "view", + "type": { + "spelling": "UIView", + "references": [ + "c:objc(cs)UIView" + ] + } + } + ], + "returns": { + "spelling": "String", + "references": [ + "s:SS" + ] + }, + "location": "file://Sources/SwiftDemo/Views.swift:5:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo8echoInt8ys0D0VADF", + "kind": "function", + "path": "echoInt8(_:)", + "name": "echoInt8(_:)", + "access": "public", + "declaration": "func echoInt8(_ value: Int8) -> Int8", + "parameters": [ + { + "internalName": "value", + "type": { + "spelling": "Int8", + "references": [ + "s:s4Int8V" + ] + } + } + ], + "returns": { + "spelling": "Int8", + "references": [ + "s:s4Int8V" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:10:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo8makeNoteyAA0D0CSSF", + "kind": "function", + "path": "makeNote(_:)", + "name": "makeNote(_:)", + "access": "public", + "declaration": "func makeNote(_ text: String) -> Note", + "parameters": [ + { + "internalName": "text", + "type": { + "spelling": "String", + "references": [ + "s:SS" + ] + } + } + ], + "returns": { + "spelling": "Note", + "references": [ + "c:@M@SwiftDemo@objc(cs)Note" + ] + }, + "location": "file://Sources/SwiftDemo/Views.swift:22:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo8mirroredySaySaySiGGADF", + "kind": "function", + "path": "mirrored(_:)", + "name": "mirrored(_:)", + "access": "public", + "declaration": "func mirrored(_ grid: [[Int]]) -> [[Int]]", + "parameters": [ + { + "internalName": "grid", + "type": { + "spelling": "[[Int]]", + "references": [ + "s:Si" + ] + } + } + ], + "returns": { + "spelling": "[[Int]]", + "references": [ + "s:Si" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:57:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo8simplifyyAA7FormulaOADF", + "kind": "function", + "path": "simplify(_:)", + "name": "simplify(_:)", + "access": "public", + "declaration": "func simplify(_ formula: Formula) -> Formula", + "parameters": [ + { + "internalName": "formula", + "type": { + "spelling": "Formula", + "references": [ + "s:9SwiftDemo7FormulaO" + ] + } + } + ], + "returns": { + "spelling": "Formula", + "references": [ + "s:9SwiftDemo7FormulaO" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:142:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo8trackersySayAA7TrackerCGSaySiGF", + "kind": "function", + "path": "trackers(_:)", + "name": "trackers(_:)", + "access": "public", + "declaration": "func trackers(_ ids: [Int]) -> [Tracker]", + "parameters": [ + { + "internalName": "ids", + "type": { + "spelling": "[Int]", + "references": [ + "s:Si" + ] + } + } + ], + "returns": { + "spelling": "[Tracker]", + "references": [ + "s:9SwiftDemo7TrackerC" + ] + }, + "location": "file://Sources/SwiftDemo/Values.swift:62:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo9countdown4from_ySi_ySi_SbtXEtF", + "kind": "function", + "path": "countdown(from:_:)", + "name": "countdown(from:_:)", + "access": "public", + "declaration": "func countdown(from start: Int, _ tick: (Int, Bool) -> Void)", + "parameters": [ + { + "label": "from", + "internalName": "start", + "type": { + "spelling": "Int", + "references": [ + "s:Si" + ] + } + }, + { + "internalName": "tick", + "type": { + "spelling": "(Int, Bool) -> Void", + "references": [ + "s:Si", + "s:Sb", + "s:s4Voida" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:74:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo9makeLabelySo7UILabelCSSF", + "kind": "function", + "path": "makeLabel(_:)", + "name": "makeLabel(_:)", + "access": "public", + "declaration": "@MainActor func makeLabel(_ text: String) -> UILabel", + "attributes": [ + "@MainActor" + ], + "parameters": [ + { + "internalName": "text", + "type": { + "spelling": "String", + "references": [ + "s:SS" + ] + } + } + ], + "returns": { + "spelling": "UILabel", + "references": [ + "c:objc(cs)UILabel" + ] + }, + "location": "file://Sources/SwiftDemo/Views.swift:7:23", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo9noteLateryAA4NoteCSSYaF", + "kind": "function", + "path": "noteLater(_:)", + "name": "noteLater(_:)", + "access": "public", + "declaration": "func noteLater(_ text: String) async -> Note", + "parameters": [ + { + "internalName": "text", + "type": { + "spelling": "String", + "references": [ + "s:SS" + ] + } + } + ], + "returns": { + "spelling": "Note", + "references": [ + "c:@M@SwiftDemo@objc(cs)Note" + ] + }, + "async": true, + "location": "file://Sources/SwiftDemo/Views.swift:25:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:9SwiftDemo9onMeasureyyyAA11MeasurementOXEF", + "kind": "function", + "path": "onMeasure(_:)", + "name": "onMeasure(_:)", + "access": "public", + "declaration": "func onMeasure(_ body: (Measurement) -> Void)", + "parameters": [ + { + "internalName": "body", + "type": { + "spelling": "(Measurement) -> Void", + "references": [ + "s:9SwiftDemo11MeasurementO", + "s:s4Voida" + ] + } + } + ], + "location": "file://Sources/SwiftDemo/Values.swift:118:12", + "graph": "SwiftDemo.symbols.json" + }, + { + "id": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", + "kind": "operator", + "path": "Precipitation.!=(_:_:)", + "name": "!=(_:_:)", + "access": "public", + "declaration": "static func != (lhs: borrowing Self, rhs: borrowing Self) -> Bool", + "modifiers": [ + "static" + ], + "static": true, + "synthesized": true, + "parameters": [ + { + "internalName": "lhs", + "type": { + "spelling": "Self" + }, + "modifier": "borrowing" + }, + { + "internalName": "rhs", + "type": { + "spelling": "Self" + }, + "modifier": "borrowing" + } + ], + "returns": { + "spelling": "Bool", + "references": [ + "s:Sb" + ] + }, + "extension": { + "extendedModule": "Swift", + "typeKind": "swift.protocol" + }, + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo13PrecipitationO", + "sourceOrigin": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ" + }, + { + "id": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO", + "kind": "operator", + "path": "Flavor.!=(_:_:)", + "name": "!=(_:_:)", + "access": "public", + "declaration": "static func != (lhs: borrowing Self, rhs: borrowing Self) -> Bool", + "modifiers": [ + "static" + ], + "static": true, + "synthesized": true, + "parameters": [ + { + "internalName": "lhs", + "type": { + "spelling": "Self" + }, + "modifier": "borrowing" + }, + { + "internalName": "rhs", + "type": { + "spelling": "Self" + }, + "modifier": "borrowing" + } + ], + "returns": { + "spelling": "Bool", + "references": [ + "s:Sb" + ] + }, + "extension": { + "extendedModule": "Swift", + "typeKind": "swift.protocol" + }, + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo6FlavorO", + "sourceOrigin": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ" + }, + { + "id": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "kind": "operator", + "path": "Polygon.Style.!=(_:_:)", + "name": "!=(_:_:)", + "access": "public", + "declaration": "static func != (lhs: borrowing Self, rhs: borrowing Self) -> Bool", + "modifiers": [ + "static" + ], + "static": true, + "synthesized": true, + "parameters": [ + { + "internalName": "lhs", + "type": { + "spelling": "Self" + }, + "modifier": "borrowing" + }, + { + "internalName": "rhs", + "type": { + "spelling": "Self" + }, + "modifier": "borrowing" + } + ], + "returns": { + "spelling": "Bool", + "references": [ + "s:Sb" + ] + }, + "extension": { + "extendedModule": "Swift", + "typeKind": "swift.protocol" + }, + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC5StyleO", + "sourceOrigin": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ" + }, + { + "id": "s:SS9SwiftDemoE7shoutedSSvp", + "kind": "instanceProperty", + "path": "String.shouted", + "name": "shouted", + "access": "public", + "declaration": "var shouted: String { get }", + "valueType": { + "spelling": "String", + "references": [ + "s:SS" + ] + }, + "settable": false, + "extension": { + "extendedModule": "Swift", + "typeKind": "swift.struct" + }, + "location": "file://Sources/SwiftDemo/Extensions.swift:18:15", + "graph": "SwiftDemo@Swift.symbols.json", + "parent": "s:SS" + }, + { + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", + "kind": "instanceProperty", + "path": "Precipitation.rawAttachmentValueRepresentation", + "name": "rawAttachmentValueRepresentation", + "access": "public", + "declaration": "var rawAttachmentValueRepresentation: CVAttachmentRawValue { get }", + "synthesized": true, + "valueType": { + "spelling": "CVAttachmentRawValue", + "references": [ + "s:9CoreVideo20CVAttachmentRawValueV" + ] + }, + "settable": false, + "extension": { + "extendedModule": "Swift", + "typeKind": "swift.protocol", + "constraints": [ + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "CVAttachmentValueRepresentable", + "rhsPrecise": "s:9CoreVideo30CVAttachmentValueRepresentableP" + } + ] + }, + "availability": [ + { + "domain": "iOS", + "introduced": "27.0.0" + }, + { + "domain": "macOS", + "introduced": "27.0.0" + }, + { + "domain": "tvOS", + "introduced": "27.0.0" + }, + { + "domain": "visionOS", + "introduced": "27.0.0" + }, + { + "domain": "watchOS", + "introduced": "27.0.0" + } + ], + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo13PrecipitationO", + "sourceOrigin": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp" + }, + { + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo6FlavorO", + "kind": "instanceProperty", + "path": "Flavor.rawAttachmentValueRepresentation", + "name": "rawAttachmentValueRepresentation", + "access": "public", + "declaration": "var rawAttachmentValueRepresentation: CVAttachmentRawValue { get }", + "synthesized": true, + "valueType": { + "spelling": "CVAttachmentRawValue", + "references": [ + "s:9CoreVideo20CVAttachmentRawValueV" + ] + }, + "settable": false, + "extension": { + "extendedModule": "Swift", + "typeKind": "swift.protocol", + "constraints": [ + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "CVAttachmentValueRepresentable", + "rhsPrecise": "s:9CoreVideo30CVAttachmentValueRepresentableP" + } + ] + }, + "availability": [ + { + "domain": "iOS", + "introduced": "27.0.0" + }, + { + "domain": "macOS", + "introduced": "27.0.0" + }, + { + "domain": "tvOS", + "introduced": "27.0.0" + }, + { + "domain": "visionOS", + "introduced": "27.0.0" + }, + { + "domain": "watchOS", + "introduced": "27.0.0" + } + ], + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo6FlavorO", + "sourceOrigin": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp" + }, + { + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "kind": "instanceProperty", + "path": "Polygon.Style.rawAttachmentValueRepresentation", + "name": "rawAttachmentValueRepresentation", + "access": "public", + "declaration": "var rawAttachmentValueRepresentation: CVAttachmentRawValue { get }", + "synthesized": true, + "valueType": { + "spelling": "CVAttachmentRawValue", + "references": [ + "s:9CoreVideo20CVAttachmentRawValueV" + ] + }, + "settable": false, + "extension": { + "extendedModule": "Swift", + "typeKind": "swift.protocol", + "constraints": [ + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "CVAttachmentValueRepresentable", + "rhsPrecise": "s:9CoreVideo30CVAttachmentValueRepresentableP" + } + ] + }, + "availability": [ + { + "domain": "iOS", + "introduced": "27.0.0" + }, + { + "domain": "macOS", + "introduced": "27.0.0" + }, + { + "domain": "tvOS", + "introduced": "27.0.0" + }, + { + "domain": "visionOS", + "introduced": "27.0.0" + }, + { + "domain": "watchOS", + "introduced": "27.0.0" + } + ], + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC5StyleO", + "sourceOrigin": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE013rawAttachmentD14RepresentationAA0cfD0Vvp" + }, + { + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", + "kind": "typeMethod", + "path": "Precipitation.makeFromRawAttachmentValue(_:)", + "name": "makeFromRawAttachmentValue(_:)", + "access": "public", + "declaration": "static func makeFromRawAttachmentValue(_ repr: CVAttachmentRawValue) -> Self?", + "modifiers": [ + "static" + ], + "static": true, + "synthesized": true, "parameters": [ { - "internalName": "value", + "internalName": "repr", "type": { - "spelling": "Int8", + "spelling": "CVAttachmentRawValue", "references": [ - "s:s4Int8V" + "s:9CoreVideo20CVAttachmentRawValueV" ] } } ], "returns": { - "spelling": "Int8", - "references": [ - "s:s4Int8V" + "spelling": "Self?" + }, + "genericConstraints": [ + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "CVAttachmentValueRepresentable", + "rhsPrecise": "s:9CoreVideo30CVAttachmentValueRepresentableP" + } + ], + "extension": { + "extendedModule": "Swift", + "typeKind": "swift.protocol", + "constraints": [ + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "CVAttachmentValueRepresentable", + "rhsPrecise": "s:9CoreVideo30CVAttachmentValueRepresentableP" + } ] }, - "location": "file://Sources/SwiftDemo/Values.swift:8:12", - "graph": "SwiftDemo.symbols.json" + "availability": [ + { + "domain": "iOS", + "introduced": "27.0.0" + }, + { + "domain": "macOS", + "introduced": "27.0.0" + }, + { + "domain": "tvOS", + "introduced": "27.0.0" + }, + { + "domain": "visionOS", + "introduced": "27.0.0" + }, + { + "domain": "watchOS", + "introduced": "27.0.0" + } + ], + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo13PrecipitationO", + "sourceOrigin": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ" }, { - "id": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", - "kind": "operator", - "path": "Precipitation.!=(_:_:)", - "name": "!=(_:_:)", + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO", + "kind": "typeMethod", + "path": "Flavor.makeFromRawAttachmentValue(_:)", + "name": "makeFromRawAttachmentValue(_:)", "access": "public", - "declaration": "static func != (lhs: borrowing Self, rhs: borrowing Self) -> Bool", + "declaration": "static func makeFromRawAttachmentValue(_ repr: CVAttachmentRawValue) -> Self?", "modifiers": [ "static" ], @@ -2314,41 +4657,71 @@ "synthesized": true, "parameters": [ { - "internalName": "lhs", - "type": { - "spelling": "Self" - }, - "modifier": "borrowing" - }, - { - "internalName": "rhs", + "internalName": "repr", "type": { - "spelling": "Self" - }, - "modifier": "borrowing" + "spelling": "CVAttachmentRawValue", + "references": [ + "s:9CoreVideo20CVAttachmentRawValueV" + ] + } } ], "returns": { - "spelling": "Bool", - "references": [ - "s:Sb" - ] + "spelling": "Self?" }, + "genericConstraints": [ + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "CVAttachmentValueRepresentable", + "rhsPrecise": "s:9CoreVideo30CVAttachmentValueRepresentableP" + } + ], "extension": { "extendedModule": "Swift", - "typeKind": "swift.protocol" + "typeKind": "swift.protocol", + "constraints": [ + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "CVAttachmentValueRepresentable", + "rhsPrecise": "s:9CoreVideo30CVAttachmentValueRepresentableP" + } + ] }, + "availability": [ + { + "domain": "iOS", + "introduced": "27.0.0" + }, + { + "domain": "macOS", + "introduced": "27.0.0" + }, + { + "domain": "tvOS", + "introduced": "27.0.0" + }, + { + "domain": "visionOS", + "introduced": "27.0.0" + }, + { + "domain": "watchOS", + "introduced": "27.0.0" + } + ], "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo13PrecipitationO", - "sourceOrigin": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ" + "parent": "s:9SwiftDemo6FlavorO", + "sourceOrigin": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ" }, { - "id": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ::SYNTHESIZED::s:9SwiftDemo6FlavorO", - "kind": "operator", - "path": "Flavor.!=(_:_:)", - "name": "!=(_:_:)", + "id": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "kind": "typeMethod", + "path": "Polygon.Style.makeFromRawAttachmentValue(_:)", + "name": "makeFromRawAttachmentValue(_:)", "access": "public", - "declaration": "static func != (lhs: borrowing Self, rhs: borrowing Self) -> Bool", + "declaration": "static func makeFromRawAttachmentValue(_ repr: CVAttachmentRawValue) -> Self?", "modifiers": [ "static" ], @@ -2356,60 +4729,105 @@ "synthesized": true, "parameters": [ { - "internalName": "lhs", - "type": { - "spelling": "Self" - }, - "modifier": "borrowing" - }, - { - "internalName": "rhs", + "internalName": "repr", "type": { - "spelling": "Self" - }, - "modifier": "borrowing" + "spelling": "CVAttachmentRawValue", + "references": [ + "s:9CoreVideo20CVAttachmentRawValueV" + ] + } } ], "returns": { - "spelling": "Bool", - "references": [ - "s:Sb" - ] + "spelling": "Self?" }, + "genericConstraints": [ + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "CVAttachmentValueRepresentable", + "rhsPrecise": "s:9CoreVideo30CVAttachmentValueRepresentableP" + } + ], "extension": { "extendedModule": "Swift", - "typeKind": "swift.protocol" + "typeKind": "swift.protocol", + "constraints": [ + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "CVAttachmentValueRepresentable", + "rhsPrecise": "s:9CoreVideo30CVAttachmentValueRepresentableP" + } + ] }, + "availability": [ + { + "domain": "iOS", + "introduced": "27.0.0" + }, + { + "domain": "macOS", + "introduced": "27.0.0" + }, + { + "domain": "tvOS", + "introduced": "27.0.0" + }, + { + "domain": "visionOS", + "introduced": "27.0.0" + }, + { + "domain": "watchOS", + "introduced": "27.0.0" + } + ], "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo6FlavorO", - "sourceOrigin": "s:SQsRi_zRi0_zrlE2neoiySbx_xtFZ" + "parent": "s:9SwiftDemo7PolygonC5StyleO", + "sourceOrigin": "s:SY9CoreVideoAA30CVAttachmentValueRepresentable03RawD0RpzrlE08makeFromf10AttachmentD0yxSgAA0cfD0VFZ" }, { - "id": "s:SS9SwiftDemoE7shoutedSSvp", + "id": "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", "kind": "instanceProperty", - "path": "String.shouted", - "name": "shouted", + "path": "Precipitation.hashValue", + "name": "hashValue", "access": "public", - "declaration": "var shouted: String { get }", + "declaration": "var hashValue: Int { get }", + "synthesized": true, "valueType": { - "spelling": "String", + "spelling": "Int", "references": [ - "s:SS" + "s:Si" ] }, "settable": false, "extension": { "extendedModule": "Swift", - "typeKind": "swift.struct" + "typeKind": "swift.protocol", + "constraints": [ + { + "kind": "conformance", + "lhs": "Self", + "rhs": "Hashable", + "rhsPrecise": "s:SH" + }, + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "Hashable", + "rhsPrecise": "s:SH" + } + ] }, - "location": "file://Sources/SwiftDemo/Extensions.swift:18:15", - "graph": "SwiftDemo@Swift.symbols.json", - "parent": "s:SS" + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo13PrecipitationO", + "sourceOrigin": "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp" }, { - "id": "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO", + "id": "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo6FlavorO", "kind": "instanceProperty", - "path": "Precipitation.hashValue", + "path": "Flavor.hashValue", "name": "hashValue", "access": "public", "declaration": "var hashValue: Int { get }", @@ -2440,13 +4858,13 @@ ] }, "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo13PrecipitationO", + "parent": "s:9SwiftDemo6FlavorO", "sourceOrigin": "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp" }, { - "id": "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo6FlavorO", + "id": "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", "kind": "instanceProperty", - "path": "Flavor.hashValue", + "path": "Polygon.Style.hashValue", "name": "hashValue", "access": "public", "declaration": "var hashValue: Int { get }", @@ -2477,7 +4895,7 @@ ] }, "graph": "SwiftDemo.symbols.json", - "parent": "s:9SwiftDemo6FlavorO", + "parent": "s:9SwiftDemo7PolygonC5StyleO", "sourceOrigin": "s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp" }, { @@ -2594,6 +5012,63 @@ "parent": "s:9SwiftDemo6FlavorO", "sourceOrigin": "s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF" }, + { + "id": "s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO", + "kind": "instanceMethod", + "path": "Polygon.Style.hash(into:)", + "name": "hash(into:)", + "access": "public", + "declaration": "func hash(into hasher: inout Hasher)", + "synthesized": true, + "parameters": [ + { + "label": "into", + "internalName": "hasher", + "type": { + "spelling": "Hasher", + "references": [ + "s:s6HasherV" + ] + }, + "modifier": "inout" + } + ], + "genericConstraints": [ + { + "kind": "conformance", + "lhs": "Self", + "rhs": "Hashable", + "rhsPrecise": "s:SH" + }, + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "Hashable", + "rhsPrecise": "s:SH" + } + ], + "extension": { + "extendedModule": "Swift", + "typeKind": "swift.protocol", + "constraints": [ + { + "kind": "conformance", + "lhs": "Self", + "rhs": "Hashable", + "rhsPrecise": "s:SH" + }, + { + "kind": "conformance", + "lhs": "Self.RawValue", + "rhs": "Hashable", + "rhsPrecise": "s:SH" + } + ] + }, + "graph": "SwiftDemo.symbols.json", + "parent": "s:9SwiftDemo7PolygonC5StyleO", + "sourceOrigin": "s:SYsSHRzSH8RawValueSYRpzrlE4hash4intoys6HasherVz_tF" + }, { "id": "s:Sa9SwiftDemoAA5PointVRszlE8centroidACyF", "kind": "instanceMethod", diff --git a/metadata-generator/tests/swift/snapshots/SwiftDemo.probe.swift b/metadata-generator/tests/swift/snapshots/SwiftDemo.probe.swift index 0888be6d..270fa448 100644 --- a/metadata-generator/tests/swift/snapshots/SwiftDemo.probe.swift +++ b/metadata-generator/tests/swift/snapshots/SwiftDemo.probe.swift @@ -2,6 +2,9 @@ // the Swift-generated surface of module SwiftDemo. import Foundation import SwiftDemo +#if canImport(UIKit) +import UIKit +#endif // s:9SwiftDemo0B0C func __nsProbe0(_ value: SwiftDemo.Demo) -> SwiftDemo.Demo { value } @@ -26,305 +29,778 @@ func __nsProbe4() { let _: SwiftDemo.Demo = SwiftDemo.Demo() } +// s:9SwiftDemo10ShapeErrorO +func __nsProbe5(_ value: SwiftDemo.ShapeError) -> SwiftDemo.ShapeError { value } + +// s:9SwiftDemo10ShapeErrorO11invalidSideyACSdcACmF +func __nsProbe6(_ a0: Double) { + let _: SwiftDemo.ShapeError = SwiftDemo.ShapeError.`invalidSide`(a0) +} + +// s:9SwiftDemo10ShapeErrorO12tooManySidesyACSi_SitcACmF +func __nsProbe7(_ a0: Int, _ a1: Int) { + let _: SwiftDemo.ShapeError = SwiftDemo.ShapeError.`tooManySides`(count: a0, limit: a1) +} + +// s:9SwiftDemo10ShapeErrorO7unknownyA2CmF +func __nsProbe8() { + let _: SwiftDemo.ShapeError = SwiftDemo.ShapeError.`unknown` +} + +// s:9SwiftDemo10allFlavorsSayAA6FlavorOGyF +func __nsProbe9() { + let _: [SwiftDemo.Flavor] = SwiftDemo.`allFlavors`() +} + // s:9SwiftDemo10echoUInt64ys0D0VADF -func __nsProbe5(_ a0: UInt64) { +func __nsProbe10(_ a0: UInt64) { let _: UInt64 = SwiftDemo.`echoUInt64`(a0) } +// s:9SwiftDemo10greetLater_10completionySSSg_yADYbctF +func __nsProbe11(_ a0: String?, _ a1: @escaping @Sendable (String?) -> Void) { + let _: Void = SwiftDemo.`greetLater`(a0, completion: a1) +} + // s:9SwiftDemo10largestIntSiyF -func __nsProbe6() { +func __nsProbe12() { let _: Int = SwiftDemo.`largestInt`() } +// s:9SwiftDemo10namesLaterySaySSGSiYaF +func __nsProbe13(_ a0: Int) async { + let _: [String] = await SwiftDemo.`namesLater`(a0) +} + +// s:9SwiftDemo10wordCountsySDySSSiGSaySSGF +func __nsProbe14(_ a0: [String]) { + let _: [String: Int] = SwiftDemo.`wordCounts`(a0) +} + +// s:9SwiftDemo11MeasurementO +func __nsProbe15(_ value: SwiftDemo.Measurement) -> SwiftDemo.Measurement { value } + +// s:9SwiftDemo11MeasurementO4UnitV +func __nsProbe16(_ value: SwiftDemo.Measurement.Unit) -> SwiftDemo.Measurement.Unit { value } + +// s:9SwiftDemo11MeasurementO4UnitV6symbolAESS_tcfc +func __nsProbe17(_ a0: String) { + let _: SwiftDemo.Measurement.Unit = SwiftDemo.Measurement.Unit(symbol: a0) +} + +// s:9SwiftDemo11MeasurementO4UnitV6symbolSSvp +func __nsProbe18(_ receiver: inout SwiftDemo.Measurement.Unit, _ newValue: String) { + let _: String = receiver.`symbol` + receiver.`symbol` = newValue +} + +// s:9SwiftDemo11MeasurementO4areayACSd_SdtcACmF +func __nsProbe19(_ a0: Double, _ a1: Double) { + let _: SwiftDemo.Measurement = SwiftDemo.Measurement.`area`(width: a0, height: a1) +} + +// s:9SwiftDemo11MeasurementO4noneyA2CmF +func __nsProbe20() { + let _: SwiftDemo.Measurement = SwiftDemo.Measurement.`none` +} + +// s:9SwiftDemo11MeasurementO6isNoneSbvp +func __nsProbe21(_ receiver: SwiftDemo.Measurement) { + let _: Bool = receiver.`isNone` +} + +// s:9SwiftDemo11MeasurementO6lengthyACSdcACmF +func __nsProbe22(_ a0: Double) { + let _: SwiftDemo.Measurement = SwiftDemo.Measurement.`length`(a0) +} + // s:9SwiftDemo11checkedSideyS2dKF -func __nsProbe7(_ a0: Double) throws { +func __nsProbe23(_ a0: Double) throws { let _: Double = try SwiftDemo.`checkedSide`(a0) } +// s:9SwiftDemo11delayedEcho_5afterS2S_SdtYaKF +func __nsProbe24(_ a0: String, _ a1: Double) async throws { + let _: String = try await SwiftDemo.`delayedEcho`(a0, after: a1) +} + +// s:9SwiftDemo12firstSubview2ofSo6UIViewCSgAE_tF +func __nsProbe25(_ a0: UIView) { + let _: UIView? = SwiftDemo.`firstSubview`(of: a0) +} + +// s:9SwiftDemo12measureLateryAA11MeasurementOSdYaF +func __nsProbe26(_ a0: Double) async { + let _: SwiftDemo.Measurement = await SwiftDemo.`measureLater`(a0) +} + +// s:9SwiftDemo12measurementsSayAA11MeasurementOGyF +func __nsProbe27() { + let _: [SwiftDemo.Measurement] = SwiftDemo.`measurements`() +} + +// s:9SwiftDemo12swapTrackersyyAA7TrackerCz_ADztF +func __nsProbe28(_ a0: inout SwiftDemo.Tracker, _ a1: inout SwiftDemo.Tracker) { + let _: Void = SwiftDemo.`swapTrackers`(&a0, &a1) +} + // s:9SwiftDemo13PrecipitationO -func __nsProbe8(_ value: SwiftDemo.Precipitation) -> SwiftDemo.Precipitation { value } +func __nsProbe29(_ value: SwiftDemo.Precipitation) -> SwiftDemo.Precipitation { value } // s:9SwiftDemo13PrecipitationO4noneyA2CmF -func __nsProbe9() { +func __nsProbe30() { let _: SwiftDemo.Precipitation = SwiftDemo.Precipitation.`none` } // s:9SwiftDemo13PrecipitationO4rainyA2CmF -func __nsProbe10() { +func __nsProbe31() { let _: SwiftDemo.Precipitation = SwiftDemo.Precipitation.`rain` } // s:9SwiftDemo13PrecipitationO4snowyA2CmF -func __nsProbe11() { +func __nsProbe32() { let _: SwiftDemo.Precipitation = SwiftDemo.Precipitation.`snow` } // s:9SwiftDemo13PrecipitationO8rawValueACSgSS_tcfc -func __nsProbe12(_ a0: String) { +func __nsProbe33(_ a0: String) { let _: SwiftDemo.Precipitation? = SwiftDemo.Precipitation(rawValue: a0) } // s:9SwiftDemo13defaultFlavorAA0D0Ovp -func __nsProbe13() { +func __nsProbe34() { let _: SwiftDemo.Flavor = SwiftDemo.`defaultFlavor` } // s:9SwiftDemo13globalCounterSivp -func __nsProbe14(_ newValue: Int) { +func __nsProbe35(_ newValue: Int) { let _: Int = SwiftDemo.`globalCounter` SwiftDemo.`globalCounter` = newValue } // s:9SwiftDemo16makeDefaultPointAA0E0VyF -func __nsProbe15() { +func __nsProbe36() { let _: SwiftDemo.Point = SwiftDemo.`makeDefaultPoint`() } +// s:9SwiftDemo16makeTrackerLater2idAA0D0CSi_tYaF +func __nsProbe37(_ a0: Int) async { + let _: SwiftDemo.Tracker = await SwiftDemo.`makeTrackerLater`(id: a0) +} + +// s:9SwiftDemo3JobO6TicketV +func __nsProbe38(_ value: SwiftDemo.Job.Ticket) -> SwiftDemo.Job.Ticket { value } + +// s:9SwiftDemo3JobO6TicketV2idAESi_tcfc +func __nsProbe39(_ a0: Int) { + let _: SwiftDemo.Job.Ticket = SwiftDemo.Job.Ticket(id: a0) +} + +// s:9SwiftDemo3JobO6TicketV2idSivp +func __nsProbe40(_ receiver: inout SwiftDemo.Job.Ticket, _ newValue: Int) { + let _: Int = receiver.`id` + receiver.`id` = newValue +} + // s:9SwiftDemo4RingV -func __nsProbe16(_ value: SwiftDemo.Ring) -> SwiftDemo.Ring { value } +func __nsProbe41(_ value: SwiftDemo.Ring) -> SwiftDemo.Ring { value } // s:9SwiftDemo4RingV5inner5outerAcA5PointV_AGtcfc -func __nsProbe17(_ a0: SwiftDemo.Point, _ a1: SwiftDemo.Point) { +func __nsProbe42(_ a0: SwiftDemo.Point, _ a1: SwiftDemo.Point) { let _: SwiftDemo.Ring = SwiftDemo.Ring(inner: a0, outer: a1) } // s:9SwiftDemo4RingV5innerAA5PointVvp -func __nsProbe18(_ receiver: inout SwiftDemo.Ring, _ newValue: SwiftDemo.Point) { +func __nsProbe43(_ receiver: inout SwiftDemo.Ring, _ newValue: SwiftDemo.Point) { let _: SwiftDemo.Point = receiver.`inner` receiver.`inner` = newValue } // s:9SwiftDemo4RingV5outerAA5PointVvp -func __nsProbe19(_ receiver: inout SwiftDemo.Ring, _ newValue: SwiftDemo.Point) { +func __nsProbe44(_ receiver: inout SwiftDemo.Ring, _ newValue: SwiftDemo.Point) { let _: SwiftDemo.Point = receiver.`outer` receiver.`outer` = newValue } // s:9SwiftDemo4RingV6expand2byySd_tF -func __nsProbe20(_ receiver: inout SwiftDemo.Ring, _ a0: Double) { +func __nsProbe45(_ receiver: inout SwiftDemo.Ring, _ a0: Double) { let _: Void = receiver.`expand`(by: a0) } +// s:9SwiftDemo4area2ofSdAA11MeasurementO_tF +func __nsProbe46(_ a0: SwiftDemo.Measurement) { + let _: Double = SwiftDemo.`area`(of: a0) +} + +// s:9SwiftDemo4bumpyySizF +func __nsProbe47(_ a0: inout Int) { + let _: Void = SwiftDemo.`bump`(&a0) +} + +// s:9SwiftDemo4echoyAA7PayloadOADF +func __nsProbe48(_ a0: SwiftDemo.Payload) { + let _: SwiftDemo.Payload = SwiftDemo.`echo`(a0) +} + +// s:9SwiftDemo4host2ofSSSg10Foundation3URLV_tF +func __nsProbe49(_ a0: URL) { + let _: String? = SwiftDemo.`host`(of: a0) +} + +// s:9SwiftDemo4rampy10Foundation4DataVSiF +func __nsProbe50(_ a0: Int) { + let _: Data = SwiftDemo.`ramp`(a0) +} + +// s:9SwiftDemo4tagsySaySiGSaySo6UIViewCGF +func __nsProbe51(_ a0: [UIView]) { + let _: [Int] = SwiftDemo.`tags`(a0) +} + +// s:9SwiftDemo4text2ofSSAA4NoteC_tF +func __nsProbe52(_ a0: SwiftDemo.Note) { + let _: String = SwiftDemo.`text`(of: a0) +} + // s:9SwiftDemo5PointV -func __nsProbe21(_ value: SwiftDemo.Point) -> SwiftDemo.Point { value } +func __nsProbe53(_ value: SwiftDemo.Point) -> SwiftDemo.Point { value } // s:9SwiftDemo5PointV11descriptionSSvp -func __nsProbe22(_ receiver: SwiftDemo.Point) { +func __nsProbe54(_ receiver: SwiftDemo.Point) { let _: String = receiver.`description` } // s:9SwiftDemo5PointV1x1yACSd_Sdtcfc -func __nsProbe23(_ a0: Double, _ a1: Double) { +func __nsProbe55(_ a0: Double, _ a1: Double) { let _: SwiftDemo.Point = SwiftDemo.Point(x: a0, y: a1) } // s:9SwiftDemo5PointV1xSdvp -func __nsProbe24(_ receiver: inout SwiftDemo.Point, _ newValue: Double) { +func __nsProbe56(_ receiver: inout SwiftDemo.Point, _ newValue: Double) { let _: Double = receiver.`x` receiver.`x` = newValue } // s:9SwiftDemo5PointV1ySdvp -func __nsProbe25(_ receiver: inout SwiftDemo.Point, _ newValue: Double) { +func __nsProbe57(_ receiver: inout SwiftDemo.Point, _ newValue: Double) { let _: Double = receiver.`y` receiver.`y` = newValue } // s:9SwiftDemo5PointV6lengthSdvp -func __nsProbe26(_ receiver: SwiftDemo.Point) { +func __nsProbe58(_ receiver: SwiftDemo.Point) { let _: Double = receiver.`length` } +// s:9SwiftDemo5clearyySSSgzF +func __nsProbe59(_ a0: inout String?) { + let _: Void = SwiftDemo.`clear`(&a0) +} + +// s:9SwiftDemo5halveyySizKF +func __nsProbe60(_ a0: inout Int) throws { + let _: Void = try SwiftDemo.`halve`(&a0) +} + +// s:9SwiftDemo5namesySaySSGSiF +func __nsProbe61(_ a0: Int) { + let _: [String] = SwiftDemo.`names`(a0) +} + // s:9SwiftDemo5shoutySSSgACF -func __nsProbe27(_ a0: String?) { +func __nsProbe62(_ a0: String?) { let _: String? = SwiftDemo.`shout`(a0) } +// s:9SwiftDemo5totalySdSaySdGF +func __nsProbe63(_ a0: [Double]) { + let _: Double = SwiftDemo.`total`(a0) +} + // s:9SwiftDemo6CanvasC -func __nsProbe28(_ value: SwiftDemo.Canvas) -> SwiftDemo.Canvas { value } +func __nsProbe64(_ value: SwiftDemo.Canvas) -> SwiftDemo.Canvas { value } + +// s:9SwiftDemo6CanvasCACycfc +@MainActor +func __nsProbe65() { + let _: SwiftDemo.Canvas = SwiftDemo.Canvas() +} // s:9SwiftDemo6FlavorO -func __nsProbe29(_ value: SwiftDemo.Flavor) -> SwiftDemo.Flavor { value } +func __nsProbe66(_ value: SwiftDemo.Flavor) -> SwiftDemo.Flavor { value } // s:9SwiftDemo6FlavorO11descriptionSSvp -func __nsProbe30(_ receiver: SwiftDemo.Flavor) { +func __nsProbe67(_ receiver: SwiftDemo.Flavor) { let _: String = receiver.`description` } // s:9SwiftDemo6FlavorO7vanillayA2CmF -func __nsProbe31() { +func __nsProbe68() { let _: SwiftDemo.Flavor = SwiftDemo.Flavor.`vanilla` } // s:9SwiftDemo6FlavorO8rawValueACSgSi_tcfc -func __nsProbe32(_ a0: Int) { +func __nsProbe69(_ a0: Int) { let _: SwiftDemo.Flavor? = SwiftDemo.Flavor(rawValue: a0) } // s:9SwiftDemo6FlavorO9chocolateyA2CmF -func __nsProbe33() { +func __nsProbe70() { let _: SwiftDemo.Flavor = SwiftDemo.Flavor.`chocolate` } // s:9SwiftDemo6LoaderC -func __nsProbe34(_ value: SwiftDemo.Loader) -> SwiftDemo.Loader { value } +func __nsProbe71(_ value: SwiftDemo.Loader) -> SwiftDemo.Loader { value } // s:9SwiftDemo6LoaderC10modernOnlyyyF @available(iOS 16.0, *) -func __nsProbe35(_ receiver: SwiftDemo.Loader) { +func __nsProbe72(_ receiver: SwiftDemo.Loader) { let _: Void = receiver.`modernOnly`() } // s:9SwiftDemo6LoaderC11legacyFetchyyF -func __nsProbe36(_ receiver: SwiftDemo.Loader) { +func __nsProbe73(_ receiver: SwiftDemo.Loader) { let _: Void = receiver.`legacyFetch`() } +// s:9SwiftDemo6LoaderC4eachyyySiXEF +func __nsProbe74(_ receiver: SwiftDemo.Loader, _ a0: (Int) -> Void) { + let _: Void = receiver.`each`(a0) +} + +// s:9SwiftDemo6LoaderC4load4path10Foundation4DataVSS_tKF +func __nsProbe75(_ receiver: SwiftDemo.Loader, _ a0: String) throws { + let _: Data = try receiver.`load`(path: a0) +} + +// s:9SwiftDemo6LoaderC4wait7secondsySd_tYaF +func __nsProbe76(_ receiver: SwiftDemo.Loader, _ a0: Double) async { + let _: Void = await receiver.`wait`(seconds: a0) +} + +// s:9SwiftDemo6LoaderC5fetch3urlSS10Foundation3URLV_tYaKF +func __nsProbe77(_ receiver: SwiftDemo.Loader, _ a0: URL) async throws { + let _: String = try await receiver.`fetch`(url: a0) +} + +// s:9SwiftDemo6LoaderC6lookup5table3keySiSgSDySSSiG_SStF +func __nsProbe78(_ receiver: SwiftDemo.Loader, _ a0: [String: Int], _ a1: String) { + let _: Int? = receiver.`lookup`(table: a0, key: a1) +} + +// s:9SwiftDemo6LoaderC6updateyyAA5PointVzF +func __nsProbe79(_ receiver: SwiftDemo.Loader, _ a0: inout SwiftDemo.Point) { + let _: Void = receiver.`update`(&a0) +} + // s:9SwiftDemo6LoaderC8oldFetchyyF -func __nsProbe37(_ receiver: SwiftDemo.Loader) { +func __nsProbe80(_ receiver: SwiftDemo.Loader) { let _: Void = receiver.`oldFetch`() } // s:9SwiftDemo6LoaderCACycfc -func __nsProbe38() { +func __nsProbe81() { let _: SwiftDemo.Loader = SwiftDemo.Loader() } // s:9SwiftDemo6SquareC -func __nsProbe39(_ value: SwiftDemo.Square) -> SwiftDemo.Square { value } +func __nsProbe82(_ value: SwiftDemo.Square) -> SwiftDemo.Square { value } // s:9SwiftDemo6SquareC4areaSdvp -func __nsProbe40(_ receiver: SwiftDemo.Square) { +func __nsProbe83(_ receiver: SwiftDemo.Square) { let _: Double = receiver.`area` } // s:9SwiftDemo6SquareC4sideACSd_tcfc -func __nsProbe41(_ a0: Double) { +func __nsProbe84(_ a0: Double) { let _: SwiftDemo.Square = SwiftDemo.Square(side: a0) } // s:9SwiftDemo6SquareC4sideSdvp -func __nsProbe42(_ receiver: SwiftDemo.Square, _ newValue: Double) { +func __nsProbe85(_ receiver: SwiftDemo.Square, _ newValue: Double) { let _: Double = receiver.`side` receiver.`side` = newValue } // s:9SwiftDemo6SquareC5greet4nameS2S_tF -func __nsProbe43(_ receiver: SwiftDemo.Square, _ a0: String) { +func __nsProbe86(_ receiver: SwiftDemo.Square, _ a0: String) { let _: String = receiver.`greet`(name: a0) } // s:9SwiftDemo6SquareC5scale2byySd_tF -func __nsProbe44(_ receiver: SwiftDemo.Square, _ a0: Double) { +func __nsProbe87(_ receiver: SwiftDemo.Square, _ a0: Double) { let _: Void = receiver.`scale`(by: a0) } // s:9SwiftDemo6SquareC5sidesSivpZ -func __nsProbe45() { +func __nsProbe88() { let _: Int = SwiftDemo.Square.`sides` } +// s:9SwiftDemo6append_2toySS_SaySSGztF +func __nsProbe89(_ a0: String, _ a1: inout [String]) { + let _: Void = SwiftDemo.`append`(a0, to: &a1) +} + // s:9SwiftDemo7CounterC -func __nsProbe46(_ value: SwiftDemo.Counter) -> SwiftDemo.Counter { value } +func __nsProbe90(_ value: SwiftDemo.Counter) -> SwiftDemo.Counter { value } + +// s:9SwiftDemo7CounterC4stepSivp +func __nsProbe91(_ receiver: SwiftDemo.Counter) async { + let _: Int = await receiver.`step` +} // s:9SwiftDemo7CounterC5labelSSyF -func __nsProbe47(_ receiver: SwiftDemo.Counter) { +func __nsProbe92(_ receiver: SwiftDemo.Counter) { let _: String = receiver.`label`() } +// s:9SwiftDemo7CounterC5valueSivp +func __nsProbe93(_ receiver: SwiftDemo.Counter) async { + let _: Int = await receiver.`value` +} + +// s:9SwiftDemo7CounterC9incrementSiyF +func __nsProbe94(_ receiver: SwiftDemo.Counter) async { + let _: Int = await receiver.`increment`() +} + // s:9SwiftDemo7CounterCACycfc -func __nsProbe48() { +func __nsProbe95() { let _: SwiftDemo.Counter = SwiftDemo.Counter() } +// s:9SwiftDemo7FormulaO +func __nsProbe96(_ value: SwiftDemo.Formula) -> SwiftDemo.Formula { value } + +// s:9SwiftDemo7FormulaO3sumyA2C_ACtcACmF +func __nsProbe97(_ a0: SwiftDemo.Formula, _ a1: SwiftDemo.Formula) { + let _: SwiftDemo.Formula = SwiftDemo.Formula.`sum`(a0, a1) +} + +// s:9SwiftDemo7FormulaO5valueSdvp +func __nsProbe98(_ receiver: SwiftDemo.Formula) { + let _: Double = receiver.`value` +} + +// s:9SwiftDemo7FormulaO6negateyA2CcACmF +func __nsProbe99(_ a0: SwiftDemo.Formula) { + let _: SwiftDemo.Formula = SwiftDemo.Formula.`negate`(a0) +} + +// s:9SwiftDemo7FormulaO6numberyACSdcACmF +func __nsProbe100(_ a0: Double) { + let _: SwiftDemo.Formula = SwiftDemo.Formula.`number`(a0) +} + +// s:9SwiftDemo7PaletteC +func __nsProbe101(_ value: SwiftDemo.Palette) -> SwiftDemo.Palette { value } + +// s:9SwiftDemo7PaletteC11strokeLaterSiyYaF +func __nsProbe102(_ receiver: SwiftDemo.Palette) async { + let _: Int = await receiver.`strokeLater`() +} + +// s:9SwiftDemo7PaletteC6strokeSiyF +@MainActor +func __nsProbe103(_ receiver: SwiftDemo.Palette) { + let _: Int = receiver.`stroke`() +} + +// s:9SwiftDemo7PaletteC7strokesSivp +@MainActor +func __nsProbe104(_ receiver: SwiftDemo.Palette) { + let _: Int = receiver.`strokes` +} + +// s:9SwiftDemo7PaletteCACycfc +@MainActor +func __nsProbe105() { + let _: SwiftDemo.Palette = SwiftDemo.Palette() +} + +// s:9SwiftDemo7PayloadO +func __nsProbe106(_ value: SwiftDemo.Payload) -> SwiftDemo.Payload { value } + +// s:9SwiftDemo7PayloadO5maybeyACSiSgcACmF +func __nsProbe107(_ a0: Int?) { + let _: SwiftDemo.Payload = SwiftDemo.Payload.`maybe`(a0) +} + +// s:9SwiftDemo7PayloadO5namesyACSaySSGcACmF +func __nsProbe108(_ a0: [String]) { + let _: SwiftDemo.Payload = SwiftDemo.Payload.`names`(a0) +} + +// s:9SwiftDemo7PayloadO5pointyAcA5PointVcACmF +func __nsProbe109(_ a0: SwiftDemo.Point) { + let _: SwiftDemo.Payload = SwiftDemo.Payload.`point`(a0) +} + +// s:9SwiftDemo7PayloadO6flavoryAcA6FlavorOcACmF +func __nsProbe110(_ a0: SwiftDemo.Flavor) { + let _: SwiftDemo.Payload = SwiftDemo.Payload.`flavor`(a0) +} + +// s:9SwiftDemo7PayloadO7trackeryAcA7TrackerCcACmF +func __nsProbe111(_ a0: SwiftDemo.Tracker) { + let _: SwiftDemo.Payload = SwiftDemo.Payload.`tracker`(a0) +} + // s:9SwiftDemo7PolygonC -func __nsProbe49(_ value: SwiftDemo.Polygon) -> SwiftDemo.Polygon { value } +func __nsProbe112(_ value: SwiftDemo.Polygon) -> SwiftDemo.Polygon { value } // s:9SwiftDemo7PolygonC11vertexCountSivp -func __nsProbe50(_ receiver: SwiftDemo.Polygon) { +func __nsProbe113(_ receiver: SwiftDemo.Polygon) { let _: Int = receiver.`vertexCount` } // s:9SwiftDemo7PolygonC4makeACyFZ -func __nsProbe51() { +func __nsProbe114() { let _: SwiftDemo.Polygon = SwiftDemo.Polygon.`make`() } // s:9SwiftDemo7PolygonC4name11vertexCountACSS_Sitcfc -func __nsProbe52(_ a0: String, _ a1: Int) { +func __nsProbe115(_ a0: String, _ a1: Int) { let _: SwiftDemo.Polygon = SwiftDemo.Polygon(name: a0, vertexCount: a1) } // s:9SwiftDemo7PolygonC4nameACSgSS_tcfc -func __nsProbe53(_ a0: String) { +func __nsProbe116(_ a0: String) { let _: SwiftDemo.Polygon? = SwiftDemo.Polygon(name: a0) } // s:9SwiftDemo7PolygonC4nameSSvp -func __nsProbe54(_ receiver: SwiftDemo.Polygon) { +func __nsProbe117(_ receiver: SwiftDemo.Polygon) { let _: String = receiver.`name` } +// s:9SwiftDemo7PolygonC5StyleO +func __nsProbe118(_ value: SwiftDemo.Polygon.Style) -> SwiftDemo.Polygon.Style { value } + +// s:9SwiftDemo7PolygonC5StyleO5solidyA2EmF +func __nsProbe119() { + let _: SwiftDemo.Polygon.Style = SwiftDemo.Polygon.Style.`solid` +} + +// s:9SwiftDemo7PolygonC5StyleO6dashedyA2EmF +func __nsProbe120() { + let _: SwiftDemo.Polygon.Style = SwiftDemo.Polygon.Style.`dashed` +} + +// s:9SwiftDemo7PolygonC5StyleO8rawValueAESgSS_tcfc +func __nsProbe121(_ a0: String) { + let _: SwiftDemo.Polygon.Style? = SwiftDemo.Polygon.Style(rawValue: a0) +} + // s:9SwiftDemo7PolygonC5scale1x1yySd_SdtF -func __nsProbe55(_ receiver: SwiftDemo.Polygon, _ a0: Double, _ a1: Double) { +func __nsProbe122(_ receiver: SwiftDemo.Polygon, _ a0: Double, _ a1: Double) { let _: Void = receiver.`scale`(x: a0, y: a1) } // s:9SwiftDemo7PolygonC5scale2byySd_tF -func __nsProbe56(_ receiver: SwiftDemo.Polygon, _ a0: Double) { +func __nsProbe123(_ receiver: SwiftDemo.Polygon, _ a0: Double) { let _: Void = receiver.`scale`(by: a0) } // s:9SwiftDemo7PolygonC5scale2byySi_tF -func __nsProbe57(_ receiver: SwiftDemo.Polygon, _ a0: Int) { +func __nsProbe124(_ receiver: SwiftDemo.Polygon, _ a0: Int) { let _: Void = receiver.`scale`(by: a0) } +// s:9SwiftDemo7PolygonC5styleAC5StyleOvp +func __nsProbe125(_ receiver: SwiftDemo.Polygon) { + let _: SwiftDemo.Polygon.Style = receiver.`style` +} + // s:9SwiftDemo7PolygonC6sharedACvpZ -func __nsProbe58() { +func __nsProbe126() { let _: SwiftDemo.Polygon = SwiftDemo.Polygon.`shared` } +// s:9SwiftDemo7PolygonC7MetricsV +func __nsProbe127(_ value: SwiftDemo.Polygon.Metrics) -> SwiftDemo.Polygon.Metrics { value } + +// s:9SwiftDemo7PolygonC7MetricsV9perimeterAESd_tcfc +func __nsProbe128(_ a0: Double) { + let _: SwiftDemo.Polygon.Metrics = SwiftDemo.Polygon.Metrics(perimeter: a0) +} + +// s:9SwiftDemo7PolygonC7MetricsV9perimeterSdvp +func __nsProbe129(_ receiver: inout SwiftDemo.Polygon.Metrics, _ newValue: Double) { + let _: Double = receiver.`perimeter` + receiver.`perimeter` = newValue +} + +// s:9SwiftDemo7PolygonC7metrics4sideAC7MetricsVSd_tF +func __nsProbe130(_ receiver: SwiftDemo.Polygon, _ a0: Double) { + let _: SwiftDemo.Polygon.Metrics = receiver.`metrics`(side: a0) +} + // s:9SwiftDemo7PolygonC8describeySSACSgFZ -func __nsProbe59(_ a0: SwiftDemo.Polygon?) { +func __nsProbe131(_ a0: SwiftDemo.Polygon?) { let _: String = SwiftDemo.Polygon.`describe`(a0) } // s:9SwiftDemo7TrackerC -func __nsProbe60(_ value: SwiftDemo.Tracker) -> SwiftDemo.Tracker { value } +func __nsProbe132(_ value: SwiftDemo.Tracker) -> SwiftDemo.Tracker { value } // s:9SwiftDemo7TrackerC2idACSi_tcfc -func __nsProbe61(_ a0: Int) { +func __nsProbe133(_ a0: Int) { let _: SwiftDemo.Tracker = SwiftDemo.Tracker(id: a0) } // s:9SwiftDemo7TrackerC2idSivp -func __nsProbe62(_ receiver: SwiftDemo.Tracker) { +func __nsProbe134(_ receiver: SwiftDemo.Tracker) { let _: Int = receiver.`id` } // s:9SwiftDemo7TrackerC4sameACyF -func __nsProbe63(_ receiver: SwiftDemo.Tracker) { +func __nsProbe135(_ receiver: SwiftDemo.Tracker) { let _: SwiftDemo.Tracker = receiver.`same`() } // s:9SwiftDemo7TrackerC9liveCountSivpZ -func __nsProbe64() { +func __nsProbe136() { let _: Int = SwiftDemo.Tracker.`liveCount` } +// s:9SwiftDemo7explainySSAA10ShapeErrorOF +func __nsProbe137(_ a0: SwiftDemo.ShapeError) { + let _: String = SwiftDemo.`explain`(a0) +} + +// s:9SwiftDemo7lengthsySDySSSiGSDyS2SGF +func __nsProbe138(_ a0: [String: String]) { + let _: [String: Int] = SwiftDemo.`lengths`(a0) +} + +// s:9SwiftDemo7measure_2byAA11MeasurementOSd_SdSgtF +func __nsProbe139(_ a0: Double, _ a1: Double?) { + let _: SwiftDemo.Measurement = SwiftDemo.`measure`(a0, by: a1) +} + +// s:9SwiftDemo7nextDay5after10Foundation4DateVAF_tF +func __nsProbe140(_ a0: Date) { + let _: Date = SwiftDemo.`nextDay`(after: a0) +} + +// s:9SwiftDemo7resolve_7against10Foundation3URLVSS_AFtF +func __nsProbe141(_ a0: String, _ a1: URL) { + let _: URL = SwiftDemo.`resolve`(a0, against: a1) +} + +// s:9SwiftDemo8NotifierC +func __nsProbe142(_ value: SwiftDemo.Notifier) -> SwiftDemo.Notifier { value } + +// s:9SwiftDemo8NotifierC12publishLateryySSF +func __nsProbe143(_ receiver: SwiftDemo.Notifier, _ a0: String) { + let _: Void = receiver.`publishLater`(a0) +} + +// s:9SwiftDemo8NotifierC5clearyyF +func __nsProbe144(_ receiver: SwiftDemo.Notifier) { + let _: Void = receiver.`clear`() +} + +// s:9SwiftDemo8NotifierC5countSivp +func __nsProbe145(_ receiver: SwiftDemo.Notifier) { + let _: Int = receiver.`count` +} + +// s:9SwiftDemo8NotifierC7publishyySSF +func __nsProbe146(_ receiver: SwiftDemo.Notifier, _ a0: String) { + let _: Void = receiver.`publish`(a0) +} + +// s:9SwiftDemo8NotifierC9subscribeyyySSYbcF +func __nsProbe147(_ receiver: SwiftDemo.Notifier, _ a0: @escaping @Sendable (String) -> Void) { + let _: Void = receiver.`subscribe`(a0) +} + +// s:9SwiftDemo8NotifierCACycfc +func __nsProbe148() { + let _: SwiftDemo.Notifier = SwiftDemo.Notifier() +} + +// s:9SwiftDemo8centroid2ofAA5PointVSayAEG_tF +func __nsProbe149(_ a0: [SwiftDemo.Point]) { + let _: SwiftDemo.Point = SwiftDemo.`centroid`(of: a0) +} + +// s:9SwiftDemo8checksumySi10Foundation4DataVF +func __nsProbe150(_ a0: Data) { + let _: Int = SwiftDemo.`checksum`(a0) +} + +// s:9SwiftDemo8describeySSSo6UIViewCF +func __nsProbe151(_ a0: UIView) { + let _: String = SwiftDemo.`describe`(a0) +} + // s:9SwiftDemo8echoInt8ys0D0VADF -func __nsProbe65(_ a0: Int8) { +func __nsProbe152(_ a0: Int8) { let _: Int8 = SwiftDemo.`echoInt8`(a0) } +// s:9SwiftDemo8makeNoteyAA0D0CSSF +func __nsProbe153(_ a0: String) { + let _: SwiftDemo.Note = SwiftDemo.`makeNote`(a0) +} + +// s:9SwiftDemo8mirroredySaySaySiGGADF +func __nsProbe154(_ a0: [[Int]]) { + let _: [[Int]] = SwiftDemo.`mirrored`(a0) +} + +// s:9SwiftDemo8simplifyyAA7FormulaOADF +func __nsProbe155(_ a0: SwiftDemo.Formula) { + let _: SwiftDemo.Formula = SwiftDemo.`simplify`(a0) +} + +// s:9SwiftDemo8trackersySayAA7TrackerCGSaySiGF +func __nsProbe156(_ a0: [Int]) { + let _: [SwiftDemo.Tracker] = SwiftDemo.`trackers`(a0) +} + +// s:9SwiftDemo9countdown4from_ySi_ySi_SbtXEtF +func __nsProbe157(_ a0: Int, _ a1: (Int, Bool) -> Void) { + let _: Void = SwiftDemo.`countdown`(from: a0, a1) +} + +// s:9SwiftDemo9makeLabelySo7UILabelCSSF +@MainActor +func __nsProbe158(_ a0: String) { + let _: UILabel = SwiftDemo.`makeLabel`(a0) +} + +// s:9SwiftDemo9noteLateryAA4NoteCSSYaF +func __nsProbe159(_ a0: String) async { + let _: SwiftDemo.Note = await SwiftDemo.`noteLater`(a0) +} + +// s:9SwiftDemo9onMeasureyyyAA11MeasurementOXEF +func __nsProbe160(_ a0: (SwiftDemo.Measurement) -> Void) { + let _: Void = SwiftDemo.`onMeasure`(a0) +} + // s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo13PrecipitationO -func __nsProbe66(_ receiver: SwiftDemo.Precipitation) { +func __nsProbe161(_ receiver: SwiftDemo.Precipitation) { let _: Int = receiver.`hashValue` } // s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo6FlavorO -func __nsProbe67(_ receiver: SwiftDemo.Flavor) { +func __nsProbe162(_ receiver: SwiftDemo.Flavor) { + let _: Int = receiver.`hashValue` +} + +// s:SYsSHRzSH8RawValueSYRpzrlE04hashB0Sivp::SYNTHESIZED::s:9SwiftDemo7PolygonC5StyleO +func __nsProbe163(_ receiver: SwiftDemo.Polygon.Style) { let _: Int = receiver.`hashValue` } +// s:s5ErrorP10FoundationE20localizedDescriptionSSvp::SYNTHESIZED::s:9SwiftDemo10ShapeErrorO +func __nsProbe164(_ receiver: SwiftDemo.ShapeError) { + let _: String = receiver.`localizedDescription` +} + diff --git a/metadata-generator/tests/swift/snapshots/swift!SwiftDemo.d.ts b/metadata-generator/tests/swift/snapshots/swift!SwiftDemo.d.ts index 575d2080..b780d738 100644 --- a/metadata-generator/tests/swift/snapshots/swift!SwiftDemo.d.ts +++ b/metadata-generator/tests/swift/snapshots/swift!SwiftDemo.d.ts @@ -11,14 +11,48 @@ declare module "ns:swift/SwiftDemo" { static readonly version: string; } + export type ShapeError = + | { case: "invalidSide"; value: number } + | { case: "tooManySides"; count: number; limit: number } + | { case: "unknown" }; + export namespace ShapeError { + /** + * Retrieve the localized description for this error. + */ + export function localizedDescription(value: ShapeError): string; + } + + export type Measurement = + | { case: "area"; width: number; height: number } + | { case: "none" } + | { case: "length"; value: number }; + export namespace Measurement { + export function isNone(value: Measurement): boolean; + export class Unit { + constructor(symbol: string); + constructor(args: { symbol: string }); + symbol: string; + } + + } + export type Precipitation = "none" | "rain" | "snow"; - export const Precipitation: { - readonly none: "none"; - readonly rain: "rain"; - readonly snow: "snow"; - init(rawValue: string): Precipitation | null; - hashValue(value: Precipitation): number; - }; + export namespace Precipitation { + export const none: "none"; + export const rain: "rain"; + export const snow: "snow"; + export function init(rawValue: string): Precipitation | null; + export function hashValue(value: Precipitation): number; + } + + export namespace Job { + export class Ticket { + constructor(id: number | bigint); + constructor(args: { id: number | bigint }); + id: number; + } + + } export class Ring { constructor(inner: Point, outer: Point); @@ -38,17 +72,17 @@ declare module "ns:swift/SwiftDemo" { } export class Canvas { - private constructor(); + constructor(); } export type Flavor = "vanilla" | "chocolate"; - export const Flavor: { - description(value: Flavor): string; - readonly vanilla: "vanilla"; - init(rawValue: number | bigint): Flavor | null; - readonly chocolate: "chocolate"; - hashValue(value: Flavor): number; - }; + export namespace Flavor { + export function description(value: Flavor): string; + export const vanilla: "vanilla"; + export function init(rawValue: number | bigint): Flavor | null; + export const chocolate: "chocolate"; + export function hashValue(value: Flavor): number; + } export class Loader { constructor(); @@ -60,6 +94,12 @@ declare module "ns:swift/SwiftDemo" { * @deprecated Use fetch(url:) instead */ legacyFetch(): void; + each(body: (arg0: number) => void): void; + load(path: string): Uint8Array; + wait(seconds: number): Promise; + fetch(url: string | URL): Promise; + lookup(table: Readonly>, key: string): number | null; + update(point: { value: Point }): void; /** * @deprecated Renamed to `fetch(url:)`. */ @@ -81,7 +121,34 @@ declare module "ns:swift/SwiftDemo" { export class Counter { constructor(); + readonly step: Promise; label(): string; + readonly value: Promise; + increment(): Promise; + } + + export type Formula = + | { case: "sum"; "0": Formula; "1": Formula } + | { case: "negate"; value: Formula } + | { case: "number"; value: number }; + export namespace Formula { + export function value(value: Formula): number; + } + + export class Palette { + constructor(); + strokeLater(): Promise; + stroke(): number; + readonly strokes: number; + } + + export type Payload = + | { case: "maybe"; value: number | null } + | { case: "names"; value: (string)[] } + | { case: "point"; value: Point } + | { case: "flavor"; value: Flavor } + | { case: "tracker"; value: Tracker }; + export namespace Payload { } export class Polygon { @@ -96,8 +163,27 @@ declare module "ns:swift/SwiftDemo" { "scale(x:y:)"(x: number, y: number): void; "scale(by: Double)"(factor: number): void; "scale(by: Int)"(factor: number | bigint): void; + readonly style: Polygon.Style; static readonly shared: Polygon; - static describe(polygon: Polygon | null | undefined): string; + metrics(side: number): Polygon.Metrics; + static describe(polygon: (Polygon) | null | undefined): string; + } + + export namespace Polygon { + export type Style = "solid" | "dashed"; + export namespace Style { + export const solid: "solid"; + export const dashed: "dashed"; + export function init(rawValue: string): Polygon.Style | null; + export function hashValue(value: Polygon.Style): number; + } + + export class Metrics { + constructor(perimeter: number); + constructor(args: { perimeter: number }); + perimeter: number; + } + } export class Tracker { @@ -108,14 +194,61 @@ declare module "ns:swift/SwiftDemo" { static readonly liveCount: number; } + export class Notifier { + constructor(); + publishLater(message: string): void; + clear(): void; + readonly count: number; + publish(message: string): void; + subscribe(handler: (arg0: string) => void): void; + } + + export function allFlavors(): (Flavor)[]; export function echoUInt64(value: number | bigint): number; + export function greetLater(name: (string) | null | undefined, completion: (arg0: string | null) => void): void; export function largestInt(): number; + export function namesLater(count: number | bigint): Promise<(string)[]>; + export function wordCounts(words: readonly (string)[]): Record; export function checkedSide(side: number): number; + export function delayedEcho(text: string, seconds: number): Promise; + export function firstSubview(view: UIView): UIView | null; + export function measureLater(width: number): Promise; + export function measurements(): (Measurement)[]; + export function swapTrackers(a: { value: Tracker }, b: { value: Tracker }): void; export const defaultFlavor: Flavor; export let globalCounter: number; export function makeDefaultPoint(): Point; - export function shout(name: string | null | undefined): string | null; + export function makeTrackerLater(id: number | bigint): Promise; + export function area(measurement: Measurement): number; + export function bump(value: { value: number | bigint }): void; + export function echo(payload: Payload): Payload; + export function host(url: string | URL): string | null; + export function ramp(count: number | bigint): Uint8Array; + export function tags(views: readonly (UIView)[]): (number)[]; + export function text(note: NSObject): string; + export function clear(name: { value: (string) | null | undefined }): void; + export function halve(value: { value: number | bigint }): void; + export function names(count: number | bigint): (string)[]; + export function shout(name: (string) | null | undefined): string | null; + export function total(values: readonly (number)[]): number; + export function append(word: string, words: { value: readonly (string)[] }): void; + export function explain(error: ShapeError): string; + export function lengths(table: Readonly>): Record; + export function measure(width: number, height: (number) | null | undefined): Measurement; + export function nextDay(date: Date): Date; + export function resolve(path: string, base: string | URL): URL; + export function centroid(points: readonly (Point)[]): Point; + export function checksum(data: ArrayBuffer | ArrayBufferView): number; + export function describe(view: UIView): string; export function echoInt8(value: number | bigint): number; + export function makeNote(text: string): NSObject; + export function mirrored(grid: readonly (readonly (number | bigint)[])[]): ((number)[])[]; + export function simplify(formula: Formula): Formula; + export function trackers(ids: readonly (number | bigint)[]): (Tracker)[]; + export function countdown(start: number | bigint, tick: (arg0: number, arg1: boolean) => void): void; + export function makeLabel(text: string): UILabel; + export function noteLater(text: string): Promise; + export function onMeasure(body: (arg0: Measurement) => void): void; } declare module "ns:swift" { diff --git a/metadata-generator/tests/swift/typescript/objc-globals.d.ts b/metadata-generator/tests/swift/typescript/objc-globals.d.ts new file mode 100644 index 00000000..df222c1d --- /dev/null +++ b/metadata-generator/tests/swift/typescript/objc-globals.d.ts @@ -0,0 +1,10 @@ +// The few Objective-C classes the SwiftDemo declarations name, standing in +// for @nativescript/types-ios. +declare class NSObject {} +declare class UIResponder extends NSObject {} +declare class UIView extends UIResponder { + tag: number; +} +declare class UILabel extends UIView { + text: string; +} diff --git a/metadata-generator/tests/swift/typescript/usage.ts b/metadata-generator/tests/swift/typescript/usage.ts index 8cb9d330..5bf02355 100644 --- a/metadata-generator/tests/swift/typescript/usage.ts +++ b/metadata-generator/tests/swift/typescript/usage.ts @@ -2,7 +2,7 @@ // the generated swift!SwiftDemo.d.ts snapshot. Every @ts-expect-error line // must fail to compile: an unused directive is itself an error. import * as swift from "ns:swift"; -import { Demo, Point, Flavor, Polygon, Square, Tracker, shout, globalCounter } from "ns:swift/SwiftDemo"; +import { Demo, Point, Flavor, Polygon, Measurement, Square, Tracker, Counter, Palette, shout, globalCounter, delayedEcho, makeTrackerLater, countdown, greetLater, Notifier, measure, area, simplify, echo, Formula, bump, append, describe, firstSubview, makeNote } from "ns:swift/SwiftDemo"; const SwiftDemo = swift.module("SwiftDemo"); const demo: Demo = new SwiftDemo.Demo(); @@ -19,12 +19,56 @@ const maybe: string | null = shout(null); const live: number = Tracker.liveCount; const counter: number = globalCounter; +const style: Polygon.Style = new Polygon("p").style; +const metrics: Polygon.Metrics = new Polygon.Metrics({ perimeter: 3 }); +const unit = new Measurement.Unit("m"); +const dashed: Polygon.Style = Polygon.Style.dashed; +void [style, metrics.perimeter, unit.symbol, dashed]; + +const echoed: Promise = delayedEcho("x", 0.1); +const later: Promise = makeTrackerLater(1); +const counterValue: Promise = new Counter().value; +const strokes: number = new Palette().stroke(); +void [echoed, later, counterValue, strokes]; + +countdown(3, (value, done) => void (value.toFixed() + (done ? "!" : ""))); +greetLater(null, (greeting) => greeting?.toUpperCase()); +const notifier = new Notifier(); +notifier.subscribe((message) => message.length); + +const measured = measure(2, 3); +const width: number = measured.case === "area" ? measured.width : 0; +const sum: Formula = simplify({ case: "sum", 0: { case: "number", value: 1 }, 1: { case: "number", value: 2 } }); +const payload = echo({ case: "maybe", value: null }); +void [width, sum, payload, area({ case: "none" })]; +const counterRef = { value: 1 }; +bump(counterRef); +const words = { value: ["a"] }; +append("b", words); +void [counterRef.value.toFixed(), words.value.length]; +const view = new UIView(); +const subview: UIView | null = firstSubview(view); +void [describe(view), subview, makeNote("n")]; +// @ts-expect-error Objective-C parameters are typed +describe("view"); +// @ts-expect-error inout parameters take a reference object +bump(1); +// @ts-expect-error a case's values are typed +area({ case: "area", width: "2", height: 3 }); +// @ts-expect-error only the enum's cases are accepted +area({ case: "circle" }); + +// @ts-expect-error closure arguments are typed +countdown(3, (value: string) => value); +// @ts-expect-error actor state is not assignable from outside the actor +new Counter().step = 2; // @ts-expect-error description is read-only point.description = "x"; // @ts-expect-error ambiguous overloads are not callable by base name square.scale(2); // @ts-expect-error Flavor is a union of case names const bad: Flavor = "mint"; -// @ts-expect-error Canvas has no initializer callable from JavaScript -new SwiftDemo.Canvas(); +// @ts-expect-error Job (a closure payload) is not bridged, only its nested types +SwiftDemo.Job.idle; +new SwiftDemo.Job.Ticket(1); void [greeting, twice, x, text, maybe, live, counter, bad]; diff --git a/tools/js2c-inputs.xcfilelist b/tools/js2c-inputs.xcfilelist index af0d3589..8ce605f4 100644 --- a/tools/js2c-inputs.xcfilelist +++ b/tools/js2c-inputs.xcfilelist @@ -18,6 +18,7 @@ $(SRCROOT)/NativeScript/runtime/js/node-util.js $(SRCROOT)/NativeScript/runtime/js/node-worker-threads.js $(SRCROOT)/NativeScript/runtime/js/ns-module.js $(SRCROOT)/NativeScript/runtime/js/ns-runtime.js +$(SRCROOT)/NativeScript/runtime/js/ns-swift.js $(SRCROOT)/NativeScript/runtime/js/ns-url.js $(SRCROOT)/NativeScript/runtime/js/ns-util.js $(SRCROOT)/NativeScript/runtime/js/ns-worker-threads.js diff --git a/types/index.d.ts b/types/index.d.ts index 94256051..3219e28f 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -27,6 +27,7 @@ /// /// +/// /// /// /// diff --git a/types/ns-swift.d.ts b/types/ns-swift.d.ts new file mode 100644 index 00000000..094ebc20 --- /dev/null +++ b/types/ns-swift.d.ts @@ -0,0 +1,31 @@ +declare module "ns:swift" { + /** + * The Swift modules whose declarations are in the program, by module name. + * The metadata generator's `swift!.d.ts` files add one entry each, + * typed as their `ns:swift/` module. + */ + export interface SwiftModules {} + + export interface SwiftModuleInfo { + readonly name: string; + /** Changes whenever the module's registered surface changes. */ + readonly fingerprint: string; + /** Interop ABI the module's thunks were generated for. */ + readonly abiVersion: number; + /** Number of registered members. */ + readonly members: number; + } + + /** Interop ABI the runtime implements. */ + export const abiVersion: number; + + /** + * A Swift module's types, functions and variables (the same object + * `ns:swift/` exports). Throws when the app does not link the + * module's generated thunks. + */ + export function module(name: Name): SwiftModules[Name]; + export function module(name: string): unknown; + + export function info(name: string): SwiftModuleInfo; +} diff --git a/v8ios.xcodeproj/project.pbxproj b/v8ios.xcodeproj/project.pbxproj index 40102693..31d62a4e 100644 --- a/v8ios.xcodeproj/project.pbxproj +++ b/v8ios.xcodeproj/project.pbxproj @@ -329,6 +329,8 @@ F1CB51832D5C37100042555E /* URLPatternImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F1CB51822D5C37100042555E /* URLPatternImpl.cpp */; }; F1CB51842D5C37100042555E /* URLPatternImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F1CB51812D5C37100042555E /* URLPatternImpl.h */; }; F1F30E742B58FC74006A62C0 /* URLImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F1F30E702B58FC74006A62C0 /* URLImpl.cpp */; }; + 6063D0D92D4AA4ED4C1F798C /* SwiftInterop.mm in Sources */ = {isa = PBXBuildFile; fileRef = C963491A0E1DB7DE246D8763 /* SwiftInterop.mm */; }; + 2CE758102F5E752AE5F9DECD /* SwiftInterop.h in Headers */ = {isa = PBXBuildFile; fileRef = 62EA5A65A7C4273D6341789E /* SwiftInterop.h */; }; F1F30E752B58FC74006A62C0 /* URLSearchParamsImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F1F30E712B58FC74006A62C0 /* URLSearchParamsImpl.cpp */; }; F1F30E762B58FC74006A62C0 /* URLSearchParamsImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F1F30E722B58FC74006A62C0 /* URLSearchParamsImpl.h */; }; F1F30E772B58FC74006A62C0 /* URLImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F1F30E732B58FC74006A62C0 /* URLImpl.h */; }; @@ -343,6 +345,13 @@ F6191AB629C0FF87003F588F /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = F6191AB429C0FF86003F588F /* utils.h */; }; F6191AB729C0FF87003F588F /* utils.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6191AB529C0FF86003F588F /* utils.mm */; }; D3FA1E7A0000000000000004 /* NativeScriptDefaultMetadata.c in Sources */ = {isa = PBXBuildFile; fileRef = D3FA1E7A0000000000000002 /* NativeScriptDefaultMetadata.c */; }; + B7AE7851BE7065026BB3D36B /* Demo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26BB7293E7339CA12962242F /* Demo.swift */; }; + A09586F9A155253666BE4E0E /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B33BDC0F84408229452C85B /* Extensions.swift */; }; + EF918E4F1A6F3E39721F8C44 /* Shapes.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA98D6B239608C28AFB14F15 /* Shapes.swift */; }; + 1A9C83B48771CCA1BBEA3F77 /* Values.swift in Sources */ = {isa = PBXBuildFile; fileRef = D76F7C886215EB9DB96CA88E /* Values.swift */; }; + 2B7A41C09E3F4D21A6C0B001 /* Views.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B7A41C09E3F4D21A6C0B002 /* Views.swift */; }; + F84875BB70573F18E4D9BA12 /* SwiftDemo+NativeScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9283D493244254925F2F5D4D /* SwiftDemo+NativeScript.swift */; }; + D3DEE264C143B4BB31683835 /* SwiftRuntimeLinkage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FFACD5929635A9739D992FE /* SwiftRuntimeLinkage.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -395,6 +404,13 @@ remoteGlobalIDString = C2F4CBB222C60BFD0036B56F; remoteInfo = "metadata-generator"; }; + EAC6F6059220EE00658E50B4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C27E277822202663009C10A3 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 25D322C92AC1521571A8C2F4; + remoteInfo = SwiftDemo; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -863,6 +879,8 @@ F1CB51812D5C37100042555E /* URLPatternImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = URLPatternImpl.h; sourceTree = ""; }; F1CB51822D5C37100042555E /* URLPatternImpl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = URLPatternImpl.cpp; sourceTree = ""; }; F1F30E702B58FC74006A62C0 /* URLImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLImpl.cpp; sourceTree = ""; }; + C963491A0E1DB7DE246D8763 /* SwiftInterop.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SwiftInterop.mm; sourceTree = ""; }; + 62EA5A65A7C4273D6341789E /* SwiftInterop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwiftInterop.h; sourceTree = ""; }; F1F30E712B58FC74006A62C0 /* URLSearchParamsImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLSearchParamsImpl.cpp; sourceTree = ""; }; F1F30E722B58FC74006A62C0 /* URLSearchParamsImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLSearchParamsImpl.h; sourceTree = ""; }; F1F30E732B58FC74006A62C0 /* URLImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLImpl.h; sourceTree = ""; }; @@ -879,6 +897,14 @@ D3FA1E7A0000000000000001 /* NativeScriptDefaultMetadata.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NativeScriptDefaultMetadata.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D3FA1E7A0000000000000002 /* NativeScriptDefaultMetadata.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = NativeScriptDefaultMetadata.c; sourceTree = ""; }; D3FA1E7A0000000000000003 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 26BB7293E7339CA12962242F /* Demo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sources/SwiftDemo/Demo.swift"; sourceTree = ""; }; + 9B33BDC0F84408229452C85B /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sources/SwiftDemo/Extensions.swift"; sourceTree = ""; }; + CA98D6B239608C28AFB14F15 /* Shapes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sources/SwiftDemo/Shapes.swift"; sourceTree = ""; }; + D76F7C886215EB9DB96CA88E /* Values.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sources/SwiftDemo/Values.swift"; sourceTree = ""; }; + 2B7A41C09E3F4D21A6C0B002 /* Views.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sources/SwiftDemo/Views.swift"; sourceTree = ""; }; + 9283D493244254925F2F5D4D /* SwiftDemo+NativeScript.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Interop/SwiftDemo+NativeScript.swift"; sourceTree = ""; }; + 8431D102ADFEC30630A1D9EB /* libSwiftDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSwiftDemo.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 2FFACD5929635A9739D992FE /* SwiftRuntimeLinkage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftRuntimeLinkage.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -942,6 +968,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 67C5137D65E8C782880B46DC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -1116,6 +1149,7 @@ C23992C8236C2D6E00D2F720 /* TestRunnerTests */, C27E5D8C22F31CCA00498ED0 /* AppWithModules */, C29374E3229FC0F60075CB16 /* TestFixtures */, + ED7A0A8FFBC394ED679DC81C /* SwiftDemo */, C2A5DFE62328C4B900A91A76 /* TKLiveSync */, D3FA1E7A0000000000000005 /* NativeScriptDefaultMetadata */, C27E278122202664009C10A3 /* Products */, @@ -1127,6 +1161,7 @@ isa = PBXGroup; children = ( C2DDEB16229EA89000345BFE /* TestRunner.app */, + 8431D102ADFEC30630A1D9EB /* libSwiftDemo.a */, C2DDEB32229EAB3B00345BFE /* NativeScript.framework */, C29374E2229FC0F60075CB16 /* libTestFixtures.a */, C2F4CBB322C60BFD0036B56F /* metadata-generator */, @@ -1424,6 +1459,7 @@ C2DDEB17229EA89000345BFE /* TestRunner */ = { isa = PBXGroup; children = ( + 2FFACD5929635A9739D992FE /* SwiftRuntimeLinkage.swift */, C2DDEBDD229EB4A900345BFE /* app */, C2DDEBDA229EB37A00345BFE /* Source Files */, C2DDEB26229EA89200345BFE /* Info.plist */, @@ -1461,6 +1497,8 @@ children = ( F1CB51812D5C37100042555E /* URLPatternImpl.h */, F1CB51822D5C37100042555E /* URLPatternImpl.cpp */, + 62EA5A65A7C4273D6341789E /* SwiftInterop.h */, + C963491A0E1DB7DE246D8763 /* SwiftInterop.mm */, F1F30E702B58FC74006A62C0 /* URLImpl.cpp */, F1F30E732B58FC74006A62C0 /* URLImpl.h */, F1F30E712B58FC74006A62C0 /* URLSearchParamsImpl.cpp */, @@ -1644,6 +1682,20 @@ path = inspector; sourceTree = ""; }; + ED7A0A8FFBC394ED679DC81C /* SwiftDemo */ = { + isa = PBXGroup; + children = ( + 26BB7293E7339CA12962242F /* Demo.swift */, + 9B33BDC0F84408229452C85B /* Extensions.swift */, + CA98D6B239608C28AFB14F15 /* Shapes.swift */, + D76F7C886215EB9DB96CA88E /* Values.swift */, + 2B7A41C09E3F4D21A6C0B002 /* Views.swift */, + 9283D493244254925F2F5D4D /* SwiftDemo+NativeScript.swift */, + ); + name = SwiftDemo; + path = "metadata-generator/TestFixtures/SwiftDemo"; + sourceTree = SOURCE_ROOT; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1676,6 +1728,7 @@ 6573B9CD291FE29F00B0ED7C /* V8Runtime.h in Headers */, C22536B5241A318900192740 /* ffitarget.h in Headers */, F1F30E772B58FC74006A62C0 /* URLImpl.h in Headers */, + 2CE758102F5E752AE5F9DECD /* SwiftInterop.h in Headers */, F6191AAE29C0FCE8003F588F /* JsV8InspectorClient.h in Headers */, A1B2C3D40000000000000003 /* WorkerInspectorClient.h in Headers */, 6573B9D0291FE29F00B0ED7C /* JSIV8ValueConverter.h in Headers */, @@ -1854,6 +1907,7 @@ dependencies = ( C22C091F22CA2E860080D176 /* PBXTargetDependency */, C293752B229FC4740075CB16 /* PBXTargetDependency */, + F2C55AEF2ADD88FECF5E82E9 /* PBXTargetDependency */, C2F4CBBC22C61CF20036B56F /* PBXTargetDependency */, C2253788241A41C500192740 /* PBXTargetDependency */, ); @@ -1916,6 +1970,22 @@ productReference = D3FA1E7A0000000000000001 /* NativeScriptDefaultMetadata.framework */; productType = "com.apple.product-type.framework"; }; + 25D322C92AC1521571A8C2F4 /* SwiftDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = DF47F91AC9C3AB512FE03BEE /* Build configuration list for PBXNativeTarget "SwiftDemo" */; + buildPhases = ( + 39094EAFF1026F65E06FE889 /* Sources */, + 67C5137D65E8C782880B46DC /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwiftDemo; + productName = SwiftDemo; + productReference = 8431D102ADFEC30630A1D9EB /* libSwiftDemo.a */; + productType = "com.apple.product-type.library.static"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -1970,6 +2040,7 @@ C27E5D8A22F31CC900498ED0 /* AppWithModules */, C2DDEB31229EAB3B00345BFE /* NativeScript */, C29374E1229FC0F60075CB16 /* TestFixtures */, + 25D322C92AC1521571A8C2F4 /* SwiftDemo */, C2F4CBB222C60BFD0036B56F /* metadata-generator */, C23992C6236C2D6E00D2F720 /* TestRunnerTests */, C2253781241A41C500192740 /* TKLiveSync */, @@ -2295,6 +2366,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + D3DEE264C143B4BB31683835 /* SwiftRuntimeLinkage.swift in Sources */, C2DDEBDC229EB37A00345BFE /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2369,6 +2441,7 @@ C2DDEBAA229EAC8300345BFE /* ModuleInternal.mm in Sources */, F1F30E752B58FC74006A62C0 /* URLSearchParamsImpl.cpp in Sources */, F1F30E742B58FC74006A62C0 /* URLImpl.cpp in Sources */, + 6063D0D92D4AA4ED4C1F798C /* SwiftInterop.mm in Sources */, C2DDEBA3229EAC8300345BFE /* ArrayAdapter.mm in Sources */, C2C8EE7422CE3266001F8CEC /* ConcurrentQueue.cpp in Sources */, C2DDEBA0229EAC8300345BFE /* Interop.mm in Sources */, @@ -2406,6 +2479,19 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 39094EAFF1026F65E06FE889 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B7AE7851BE7065026BB3D36B /* Demo.swift in Sources */, + A09586F9A155253666BE4E0E /* Extensions.swift in Sources */, + EF918E4F1A6F3E39721F8C44 /* Shapes.swift in Sources */, + 1A9C83B48771CCA1BBEA3F77 /* Values.swift in Sources */, + 2B7A41C09E3F4D21A6C0B001 /* Views.swift in Sources */, + F84875BB70573F18E4D9BA12 /* SwiftDemo+NativeScript.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -2457,6 +2543,15 @@ target = C2F4CBB222C60BFD0036B56F /* metadata-generator */; targetProxy = C2F4CBBB22C61CF20036B56F /* PBXContainerItemProxy */; }; + F2C55AEF2ADD88FECF5E82E9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + platformFilters = ( + ios, + xros, + ); + target = 25D322C92AC1521571A8C2F4 /* SwiftDemo */; + targetProxy = EAC6F6059220EE00658E50B4 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ @@ -2872,6 +2967,8 @@ CoreGraphics, "-force_load", "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libTestFixtures.a", + "-Wl,-u,_ns_swift_register_SwiftDemo", + "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libSwiftDemo.a", "-sectcreate", __DATA, __TNSMetadata, @@ -2879,6 +2976,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = vm.org.nativescript.TestRunner; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; STRIPFLAGS = "-s $(PROJECT_DIR)/TestFixtures/exported-symbols.txt"; @@ -2928,6 +3026,8 @@ CoreGraphics, "-force_load", "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libTestFixtures.a", + "-Wl,-u,_ns_swift_register_SwiftDemo", + "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/libSwiftDemo.a", "-sectcreate", __DATA, __TNSMetadata, @@ -2935,6 +3035,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = vm.org.nativescript.TestRunner; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = iphoneos; STRIPFLAGS = "-s $(PROJECT_DIR)/TestFixtures/exported-symbols.txt"; @@ -3237,6 +3338,32 @@ }; name = Release; }; + 367136433311CFF0FDB0C91E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + SYMROOT = build; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 445B0766107C823B92906250 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + SYMROOT = build; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -3321,6 +3448,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + DF47F91AC9C3AB512FE03BEE /* Build configuration list for PBXNativeTarget "SwiftDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 367136433311CFF0FDB0C91E /* Debug */, + 445B0766107C823B92906250 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = C27E277822202663009C10A3 /* Project object */;