Skip to content
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

[swift2objc] Support Protocols #1832

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nikeokoronkwo
Copy link
Contributor

@nikeokoronkwo nikeokoronkwo commented Dec 18, 2024

From https://docs.swift.org/swift-book/documentation/the-swift-programming-language/protocols/#Protocol-Extensions:

A protocol defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementation of those requirements. Any type that satisfies the requirements of a protocol is said to conform to that protocol.

This pull request adds support for parsing protocols by achieving the following:

  • Adding support for parsing basic protocols
  • Adding parsing support for optional methods and properties
  • Adding parsing support for conformed protocols (protocols that the given protocol inherits)
  • Adding support for custom types in protocols via associatedTypes
  • Adding support for methods and properties that act as default initialisations for protocols
  • Writing tests that cover all given requirements

See #1828 for more information

@nikeokoronkwo
Copy link
Contributor Author

Extension support (#1815) might need to be added to implement default initialisation functionality

Copy link

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

@liamappelbe
Copy link
Contributor

Extension support (#1815) might need to be added to implement default initialisation functionality

If there's a detail of this PR that will require a whole lot of extra effort to implement, just file a bug (or comment on an existing bug) and leave a TODO in the code to finish that work later. You don't have to do the whole feature in one PR. This means you can land your PRs quicker, and it also makes them easier for me to review because the individual PRs will be smaller and simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants