Bug 218393 - Add SwiftUI MiniBrowser
Summary: Add SwiftUI MiniBrowser
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adam Roben (:aroben)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-10-30 10:07 PDT by Adam Roben (:aroben)
Modified: 2020-11-03 12:17 PST (History)
6 users (show)

See Also:


Attachments
Patch (113.75 KB, patch)
2020-10-30 10:07 PDT, Adam Roben (:aroben)
no flags Details | Formatted Diff | Diff
Patch (113.77 KB, patch)
2020-10-30 10:09 PDT, Adam Roben (:aroben)
no flags Details | Formatted Diff | Diff
Patch for landing (116.64 KB, patch)
2020-11-03 11:28 PST, Adam Roben (:aroben)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2020-10-30 10:07:19 PDT
Created attachment 412762 [details]
Patch

This change provides a SwiftUI MiniBrowser implementation as well as a very preliminary SwiftUI wrapper for WKWebView, originally authored by James Savage. This only exposes a subset of the WKWebView API, and is definitely not production ready yet, but will give us a place to experiment with ways to make WebKit and SwiftUI work together better.
Comment 1 Adam Roben (:aroben) 2020-10-30 10:09:47 PDT
Created attachment 412765 [details]
Patch
Comment 2 Tim Horton 2020-10-30 12:18:18 PDT
Comment on attachment 412765 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=412765&action=review

I haven't looked deeply at the Swift, at all, but since it's a tool and meant for iteration, I think this is fine. rs=me

> Tools/MiniBrowserSwiftUI/Shared/URLField.swift:74
> +        #if os(macOS)

does Swift not let you outdent these like we usually do? (applies to many places)

> Tools/MiniBrowserSwiftUI/Shared/URLField.swift:139
> +        // FIXME: In real Safari, this is actually a material not a solid color.

Probably OK to elide this
Comment 3 Adam Roben (:aroben) 2020-10-30 12:46:25 PDT
(In reply to Tim Horton from comment #2)

Thanks for the review!

> > Tools/MiniBrowserSwiftUI/Shared/URLField.swift:74
> > +        #if os(macOS)
> 
> does Swift not let you outdent these like we usually do? (applies to many
> places)

Swift does let you outdent them. Xcode's default is to keep them at the same indentation level, unlike its default for ObjC/C++ code.

I did some quick searching around on GitHub and saw a mix of styles, even within a single project. I checked SwiftLint but couldn't find a rule to enforce this either way.

I'm fine with outdenting even though it will mean fighting Xcode a little bit.

> > Tools/MiniBrowserSwiftUI/Shared/URLField.swift:139
> > +        // FIXME: In real Safari, this is actually a material not a solid color.
> 
> Probably OK to elide this

Agreed, I'll remove it.
Comment 4 Adam Roben (:aroben) 2020-11-03 11:28:06 PST
Created attachment 413082 [details]
Patch for landing
Comment 5 EWS 2020-11-03 12:16:19 PST
Committed r269326: <https://trac.webkit.org/changeset/269326>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 413082 [details].
Comment 6 Radar WebKit Bug Importer 2020-11-03 12:17:22 PST
<rdar://problem/71005682>