Skip to content

objc: update demo to use direct interfaces#381

Merged
rebello95 merged 2 commits intomasterfrom
objc-demo
Aug 23, 2019
Merged

objc: update demo to use direct interfaces#381
rebello95 merged 2 commits intomasterfrom
objc-demo

Conversation

@rebello95
Copy link
Copy Markdown
Contributor

Updates our Swift example app to use the Envoy Mobile direct interfaces rather than using URLSession and Envoy as a listener.

Similar change to #349 which updated the Swift example app.

Notes:

  • Changed all Objective-C demo app sources to .m, as they don't contain C/++ and thus don't need to be .mm
  • Had to make some unfortunate changes to Client.swift and move the extension function to be implemented directly by the Envoy class, since extensions aren't allowed on Swift protocols that are visible to Objective-C. This temporarily breaks the ClientTests.swift file (not being run on CI), and I will open a PR after this lands to refactor/fix as necessary

Signed-off-by: Michael Rebello me@michaelrebello.com

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
@rebello95 rebello95 requested a review from junr03 August 23, 2019 20:36
Copy link
Copy Markdown
Contributor

@goaway goaway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@rebello95 rebello95 merged commit 9189c25 into master Aug 23, 2019
@rebello95 rebello95 deleted the objc-demo branch August 23, 2019 21:20
rebello95 added a commit that referenced this pull request Sep 3, 2019
#381 surfaced an issue where extensions aren't allowed on Swift protocols that are visible to Objective-C. This meant that the Swift `Client` protocol (conformed to by the `Envoy` Swift class) could not provide a default implementation of the non-streaming `send` function, and the function had to be moved into the concrete `Envoy` class so that it could be visible from both Swift and Objective-C. This ended up breaking our Swift tests in `ClientTests.swift` (as mentioned in that PR's description).

In order to fix these tests, we need to convert `EnvoyHTTPStream` into a protocol and use an `EnvoyHTTPStreamImpl` concrete type - similarly to how we do with `EnvoyEngine`/`EnvoyEngineImpl`.

This PR updates the types accordingly, and fixes the tests. Also renames the tests to `EnvoyTests` rather than `ClientTests` since this is testing the concrete type.

Signed-off-by: Michael Rebello <me@michaelrebello.com>
jpsim pushed a commit to envoyproxy/envoy that referenced this pull request Nov 28, 2022
envoyproxy/envoy-mobile#381 surfaced an issue where extensions aren't allowed on Swift protocols that are visible to Objective-C. This meant that the Swift `Client` protocol (conformed to by the `Envoy` Swift class) could not provide a default implementation of the non-streaming `send` function, and the function had to be moved into the concrete `Envoy` class so that it could be visible from both Swift and Objective-C. This ended up breaking our Swift tests in `ClientTests.swift` (as mentioned in that PR's description).

In order to fix these tests, we need to convert `EnvoyHTTPStream` into a protocol and use an `EnvoyHTTPStreamImpl` concrete type - similarly to how we do with `EnvoyEngine`/`EnvoyEngineImpl`.

This PR updates the types accordingly, and fixes the tests. Also renames the tests to `EnvoyTests` rather than `ClientTests` since this is testing the concrete type.

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit to envoyproxy/envoy that referenced this pull request Nov 29, 2022
envoyproxy/envoy-mobile#381 surfaced an issue where extensions aren't allowed on Swift protocols that are visible to Objective-C. This meant that the Swift `Client` protocol (conformed to by the `Envoy` Swift class) could not provide a default implementation of the non-streaming `send` function, and the function had to be moved into the concrete `Envoy` class so that it could be visible from both Swift and Objective-C. This ended up breaking our Swift tests in `ClientTests.swift` (as mentioned in that PR's description).

In order to fix these tests, we need to convert `EnvoyHTTPStream` into a protocol and use an `EnvoyHTTPStreamImpl` concrete type - similarly to how we do with `EnvoyEngine`/`EnvoyEngineImpl`.

This PR updates the types accordingly, and fixes the tests. Also renames the tests to `EnvoyTests` rather than `ClientTests` since this is testing the concrete type.

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: JP Simard <jp@jpsim.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants