google / google/j2objc

Feature request:NS_SWIFT_NAME (--swift-friendly)

Open
#753 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6k
Forks
999
Avg merge
19h 20m
Merged PRs (30d)
14

Description

It would also be nice, if the `NS_SWIFT_NAME` macro could be generated:

source: [docs](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html)

**example:**

``` objc
// winded.h
@interface LongWinded
#pragma mark Public
// - (instance...)init(...
- (SomeOtherType*)LongWinded_functionCompoundedWithMoreCruft
:(MoreCruft*)moreCruft:andSomeMore:(*SomeMore)someMore
NS_SWIFT_NAME(crufty(moreCruft:someMore:));
@end
```

``` swift
// winded.swift
let lw = LongWinded()
lw.crufty(MoreCruft(), SomeMore())
```

`"crufty"` by default should be the original java method name. This should only apply to publicly declared methods.

p.s. I am fully aware that `--mapping` exists to alleviate some of this pain, but to define the mappings is a pain by itself. Also, I know I can declare an extension or Category to "rename" a method, but this shouldn't be necessary.

Thanks!

p.p.s. There are other macros like: `NS_REFINED_FOR_SWIFT, NS_SWIFT_UNAVAILABLE` but I'm not really sure how to apply those automatedly

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.