Skip to content

Commit 5d6e43c

Browse files
committed
Merge branch 'master' of github.com:liveviewnative/liveview-client-swiftui into link
2 parents 3ef607e + f82052d commit 5d6e43c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1486
-1578
lines changed

Package.resolved

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ let package = Package(
1818
// Dependencies declare other packages that this package depends on.
1919
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.3.2"),
2020
.package(url: "https://github.com/davidstump/SwiftPhoenixClient.git", .upToNextMinor(from: "5.0.0")),
21-
.package(url: "https://github.com/siteline/SwiftUI-Introspect.git", .upToNextMinor(from: "0.1.4")),
2221
.package(url: "https://github.com/liveviewnative/liveview-native-core-swift.git", branch: "main"),
2322
],
2423
targets: [
@@ -29,11 +28,8 @@ let package = Package(
2928
dependencies: [
3029
"SwiftSoup",
3130
"SwiftPhoenixClient",
32-
.product(name: "Introspect", package: "SwiftUI-Introspect"),
33-
.target(name: "LVNObjC"),
3431
.product(name: "LiveViewNativeCore", package: "liveview-native-core-swift"),
3532
]),
36-
.target(name: "LVNObjC"),
3733
.testTarget(
3834
name: "LiveViewNativeTests",
3935
dependencies: ["LiveViewNative"]),

Sources/LVNObjC/ProxyingNavigationControllerDelegate.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

Sources/LVNObjC/ProxyingNavigationControllerDelegate.m

Lines changed: 0 additions & 40 deletions
This file was deleted.

Sources/LVNObjC/include/LVNObjC.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

Sources/LiveViewNative/BuiltinRegistry.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ struct BuiltinRegistry {
1616
switch name {
1717
case "textfield":
1818
TextField<R>(element: element, context: context)
19+
case "securefield":
20+
SecureField<R>(element: element, context: context)
1921
case "text":
2022
Text(element: element, context: context)
2123
case "hstack":
@@ -47,8 +49,6 @@ struct BuiltinRegistry {
4749

4850
case "phx-form":
4951
PhxForm<R>(element: element, context: context)
50-
case "phx-hero":
51-
PhxHeroView(element: element, context: context)
5252
case "phx-submit-button":
5353
PhxSubmitButton(element: element, context: context)
5454
default:
@@ -59,9 +59,9 @@ struct BuiltinRegistry {
5959

6060
enum ModifierType: String {
6161
case frame
62-
case listRowInsets = "list_row_insets"
63-
case listRowSeparator = "list_row_separator"
64-
case navigationTitle = "navigation_title"
62+
case listRowInsets
63+
case listRowSeparator
64+
case navigationTitle
6565
case padding
6666
case tint
6767
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// LiveConnectionError.swift
3+
//
4+
//
5+
// Created by Carson Katri on 1/6/23.
6+
//
7+
8+
import Foundation
9+
import SwiftPhoenixClient
10+
11+
public enum LiveConnectionError: Error {
12+
case initialFetchError(Error)
13+
case initialFetchUnexpectedResponse(URLResponse)
14+
/// An error encountered when parsing the initial HTML.
15+
case initialParseError
16+
case socketError(Error)
17+
case joinError(Message)
18+
case eventError(Message)
19+
20+
var localizedDescription: String {
21+
switch self {
22+
case .initialFetchError(let error):
23+
return "initialFetchError(\(error))"
24+
case .initialFetchUnexpectedResponse(let resp):
25+
return "initialFetchUnexpectedResponse(\(resp))"
26+
case .initialParseError:
27+
return "initialParseError"
28+
case .socketError(let error):
29+
return "socketError(\(error))"
30+
case .joinError(let message):
31+
return "joinError(\(message.payload))"
32+
case .eventError(let message):
33+
return "eventError(\(message.payload))"
34+
}
35+
}
36+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// LiveNavigationEntry.swift
3+
//
4+
//
5+
// Created by Carson Katri on 1/10/23.
6+
//
7+
8+
import Foundation
9+
10+
struct LiveNavigationEntry<R: CustomRegistry>: Hashable {
11+
let url: URL
12+
let coordinator: LiveViewCoordinator<R>
13+
14+
static func == (lhs: Self, rhs: Self) -> Bool {
15+
lhs.url == rhs.url && lhs.coordinator === rhs.coordinator
16+
}
17+
18+
func hash(into hasher: inout Hasher) {
19+
hasher.combine(url)
20+
hasher.combine(ObjectIdentifier(coordinator))
21+
}
22+
}

Sources/LiveViewNative/LiveViewConfiguration.swift renamed to Sources/LiveViewNative/Coordinators/LiveSessionConfiguration.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//
2-
// LiveViewConfiguration.swift
2+
// LiveSessionConfiguration.swift
33
// LiveViewNative
44
//
55
// Created by Shadowfacts on 3/30/22.
66
//
77

88
import Foundation
99

10-
/// An object that configures the behavior of a ``LiveViewCoordinator``.
11-
public struct LiveViewConfiguration {
10+
/// An object that configures the behavior of a ``LiveSessionCoordinator``.
11+
public struct LiveSessionConfiguration {
1212
/// Whether this coordinators allows its live view to navigate.
1313
///
1414
/// By default, navigation is ``NavigationMode-swift.enum/disabled``.
@@ -25,10 +25,10 @@ public struct LiveViewConfiguration {
2525

2626
// Non-final API for internal use only.
2727
@_spi(NarwinChat)
28-
public var eventHandlersEnabled: Bool = false
28+
public var eventHandlersEnabled: Bool = true
2929

3030
@_spi(NarwinChat)
31-
public var liveRedirectsEnabled: Bool = false
31+
public var liveRedirectsEnabled: Bool = true
3232

3333
/// Constructs a default, empty configuration.
3434
public init() {
@@ -42,5 +42,7 @@ public struct LiveViewConfiguration {
4242
case replaceOnly
4343
/// Navigation is fully enabled. Both replace and push redirects are allowed.
4444
case enabled
45+
/// Navigation is fully enabled and uses a `NavigationSplitView` for the UI.
46+
case splitView
4547
}
4648
}

0 commit comments

Comments
 (0)