Bug 218393

Summary: Add SwiftUI MiniBrowser
Product: WebKit Reporter: Adam Roben (:aroben) <aroben>
Component: Tools / TestsAssignee: Adam Roben (:aroben) <aroben>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, james.savage, mjs, sam, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing none

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>