jpsim / jpsim/SourceKitten

[Question] Omit needless words in property names (i.e. `UIApplication.sharedApplication` should be `shared`).

Open
#391 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
2.4k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

Command:

sourcekitten doc --objc import.ios.h -- -x objective-c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -I $(pwd)

import.ios.h:

#import "declaration.ios.h"

declaration.ios.h:

#import <UIKit/UIKit.h>

// Renamed UIApplication to MyApplication to avoid `error: duplicate interface definition ...'
@interface MyApplication
#if UIKIT_DEFINE_AS_PROPERTIES
@property(class, nonatomic, readonly) UIApplication *sharedApplication NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.");
#else

+ (UIApplication *)sharedApplication NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.");
#endif

@end

Output contains the following "key.swift_declaration":

class var sharedApplication: UIApplication! { get }

Expected:

class var application: UIApplication! { get }

If I undefine UIKIT_DEFINE_AS_PROPERTIES, the same issue remains:

class func sharedApplication() -> UIApplication!

Any hints how do I get the correct Swift property name (shared)?
Note that I'm receiving the same issue with other property declarations imported from UIKit/UIApplication.h.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the shown sourcekitten doc command and the import.ios.h/declaration.ios.h headers. Compare key.swift_declaration for the property and method forms, then trace whether the name comes from SourceKitten or the Objective-C-to-Swift importer. Done means identifying the responsible layer and verifying the expected imported name.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, swift
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.