-
Notifications
You must be signed in to change notification settings - Fork 1k
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
chore(iOS): Redefining bridge API #3678
Conversation
… updated umbrella headers, updated project settings, removed Capacitor project's Podfile. Updated respective podspecs to match.
…tub for CAPBridge.
ios/Capacitor/Capacitor/CAPLog.swift
Outdated
public static func print(_ items: Any..., separator: String = " ", terminator: String = "\n") { | ||
oneTimeConfigCheck() | ||
if enableLogging { | ||
if !self.hideLogs() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't understand why this is checked dynamically on every single log call — it's enormously wasteful, because the value can't change during runtime. It really should be a static value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reverting a workaround for a bug that appeared during testing (a different workaround is used for the time being). Eventually, it will be a static flag as configuration is revisited in support of #3182
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for letting me know.
It looks like |
This branch has two goals:
Isolate the bridge behind a protocol so that the publicly exposed API can be easily parsed and understood. The scope of the old API was extremely difficult to grasp because of the lack of organization and unclear rules for cross-language (Swift <-> Obj-C) importation.
Update the exposed API to be more consistent and idiomatic while preserving backwards-compatibility wherever possible.
The first goal is accomplished through the declaration of the
CAPBridgeProtocol
, which is what plugins have access to, and making the actual bridge and related objectsinternal
. Making the bridge internal meant it needed to be renamed so a newCAPBridge
class could be exposed to provide a stub for any static methods, in order to preserve backwards compatibility.The app delegate-related methods have been split into a separate object as they are independent functionality. And that new
AppDelegateProxy
object needs to be made public.