- 
        Couldn't load subscription status. 
- Fork 158
Support beta status in navigator #1249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
898459f
              7acb796
              b7d9ecb
              7b266fa
              4e59b21
              d8b686e
              0a6fbba
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| /* | ||
| This source file is part of the Swift.org open source project | ||
|  | ||
| Copyright (c) 2024 Apple Inc. and the Swift project authors | ||
| Copyright (c) 2024-2025 Apple Inc. and the Swift project authors | ||
| Licensed under Apache License v2.0 with Runtime Library Exception | ||
|  | ||
| See https://swift.org/LICENSE.txt for license information | ||
|  | @@ -40,6 +40,7 @@ protocol NavigatorIndexableRenderMetadataRepresentation { | |
| var roleHeading: String? { get } | ||
| var symbolKind: String? { get } | ||
| var platforms: [AvailabilityRenderItem]? { get } | ||
| var isBeta: Bool { get } | ||
| } | ||
|  | ||
| extension NavigatorIndexableRenderNodeRepresentation { | ||
|  | @@ -122,6 +123,16 @@ struct RenderNodeVariantView: NavigatorIndexableRenderNodeRepresentation { | |
| } | ||
| } | ||
|  | ||
| extension NavigatorIndexableRenderMetadataRepresentation { | ||
| var isBeta: Bool { | ||
| guard let platforms, !platforms.isEmpty else { | ||
| return false | ||
| } | ||
|  | ||
| return platforms.allSatisfy { $0.isBeta == true } | ||
| } | ||
| 
      Comment on lines
    
      +127
     to 
      +133
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code it's repeated in  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have an idea for how we can do this, by defining this extension: extension Array where Array.Element == AvailabilityRenderItem {
    var isBeta: Bool {
        guard !self.isEmpty else {
            return false
        }
        
        return self.allSatisfy { $0.isBeta == true }
    }
}I will open a separate PR with this proposal so that we can review/discuss separately :) | ||
| } | ||
|  | ||
| private let typesThatShouldNotUseNavigatorTitle: Set<NavigatorIndex.PageType> = [ | ||
| .framework, .class, .structure, .enumeration, .protocol, .typeAlias, .associatedType, .extension | ||
| ] | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this check that
cursor + lengthfits within the data? Currently, it's still possible that this code would index out of bounds. (same below)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to a few lines below I added an assertion to catch if this happens. d3e651d