-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
) * Add support for new Swift 5.1 and 5.3 features. 1. [`some` keyword][1] (Introduced in Swift 5.1) 2. [`@main` attribute][2] (Introduced in Swift 5.3) These language syntax features are utilized heavily in code that depends on the `SwiftUI` framework for user interfaces. [1]: https://github.com/apple/swift-evolution/blob/main/proposals/0244-opaque-result-types.md [2]: https://github.com/apple/swift-evolution/blob/main/proposals/0281-main-attribute.md * Update Swift keyword `$pattern` to include "#". The default of lexeme pattern of `/\w+/` is not sufficient to capture keywords that start with a number sign character (like `#if` as one example). This updates the pattern to also recognize the number sign character as well as other alphanumeric characters that were previously recognized. [1] [1]: https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID413
- Loading branch information
Showing
5 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,3 +308,4 @@ Contributors: | |
- Marat Nagayev <[email protected]> | ||
- Patrick Scheibe <[email protected]> | ||
- Kyle Brown <kylebrown9@github> | ||
- Marcus Ortiz <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<span class="hljs-meta">@main</span> | ||
<span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">MyApp</span>: <span class="hljs-title">App</span> </span>{ | ||
<span class="hljs-keyword">var</span> body: <span class="hljs-keyword">some</span> <span class="hljs-type">Scene</span> { | ||
<span class="hljs-type">WindowGroup</span> { | ||
<span class="hljs-keyword">#if</span> os(iOS) | ||
<span class="hljs-type">Text</span>(<span class="hljs-string">"Hello, world from iOS!"</span>) | ||
<span class="hljs-keyword">#else</span> | ||
<span class="hljs-type">Text</span>(<span class="hljs-string">"Hello, world!"</span>) | ||
<span class="hljs-keyword">#endif</span> | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@main | ||
struct MyApp: App { | ||
var body: some Scene { | ||
WindowGroup { | ||
#if os(iOS) | ||
Text("Hello, world from iOS!") | ||
#else | ||
Text("Hello, world!") | ||
#endif | ||
} | ||
} | ||
} |