Skip to content

Conversation

@n8henrie
Copy link
Member

  • macos-12 runner is deprecated
  • Remove complex macros, which break compilation with Swift
  • Remove complex macros, which are incompatible with Swift
  • Add missing imports
  • Add blank swift file
  • Use Swift 6.0
  • Fix minimum version message and https URL
  • Remove outdated version target
  • Add bare minimum to run swift from objc
  • Swift 6.0 not avail in GHA runners at this point (xcode 15), stick to swift 5 for now
  • Remove dummy Swift code

Follow `macos-latest`; if issues come up, can always temporarily pin to
the latest working version
https://developer.apple.com/documentation/swift/using-imported-c-macros-in-swift#Use-Functions-and-Generics-Instead-of-Complex-Macros

> C macros that are more complex than simple constant definitions have
> no counterpart in Swift. You use complex macros in C and Objective-C
> to avoid type-checking constraints or to avoid retyping large amounts
> of boilerplate code. However, macros can make debugging and refactoring
> difficult. In Swift, you can use functions and generics to achieve the
> same results without any compromises.
@n8henrie
Copy link
Member Author

Probably should squash when / if these are merged. @pjrobertson looking forward to your review!

Copy link
Member

@skurfer skurfer left a comment

Choose a reason for hiding this comment

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

Built and ran it locally to be sure, but looks good!

Also, you can just create branches in this repo. No need to have a fork once you have access here.

id handlerClass = nil;
NSString *key = nil;
NSEnumerator *kEnum = [[QSReg tableNamed:kQSPlugInInfoHandlers] keyEnumerator];
while((key = [kEnum nextObject]) && (handlerClass = [[QSReg tableNamed:kQSPlugInInfoHandlers] objectForKey:key]) ) {
Copy link
Member

Choose a reason for hiding this comment

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

Another enumerateKeysAndObjectsUsingBlock

Copy link
Member Author

Choose a reason for hiding this comment

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

EDIT: moved from above

How does this look?

[[QSReg tableNamed:kQSPlugInInfoHandlers] enumerateKeysAndObjectsUsingBlock:^(NSString *key, id handlerClass, BOOL * _Nonnull stop) {
	id value = [bundle dictionaryForFileOrPlistKey:key];
	if (!value) {
		return;
	}
	//NSLog(@"----> Registering %@ for %@", key, [self name]);
	id handler = [QSReg getClassInstance:handlerClass];
	if ([handler respondsToSelector:@selector(handleInfo:ofType:fromBundle:)])
		[handler handleInfo:value ofType:key fromBundle:[self bundle]];
}];

@n8henrie n8henrie requested a review from pjrobertson February 13, 2025 20:30
@n8henrie
Copy link
Member Author

@pjrobertson I think I got those blocks rewritten -- I like that much better, thanks for pointing out that method (initial draft was just a naive translation of the macro).

Unfortunately running the tests immediately crashes XCode right now (wtf xcode), so hopefully things pass in CI. QS still seems to run with these changes, so hopefully they're right.

@pjrobertson
Copy link
Member

Looks spot on! I've merged :)

@pjrobertson pjrobertson merged commit 7145a93 into quicksilver:main Feb 14, 2025
2 checks passed
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.

3 participants