Skip to content

Commit 458f5f3

Browse files
authored
docs(CordovaLib): Start filling out DocC comments (#1476)
1 parent 8e59e52 commit 458f5f3

File tree

12 files changed

+276
-41
lines changed

12 files changed

+276
-41
lines changed

CordovaLib/Classes/Private/Plugins/CDVLaunchScreen/CDVLaunchScreen.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ Licensed to the Apache Software Foundation (ASF) under one
2121

2222
@implementation CDVLaunchScreen
2323

24-
- (void)show:(CDVInvokedUrlCommand*)command
24+
- (void)show:(CDVInvokedUrlCommand *)command
2525
{
26-
[self.viewController showLaunchScreen:YES];
26+
[self.viewController showSplashScreen:YES];
2727
}
2828

29-
- (void)hide:(CDVInvokedUrlCommand*)command
29+
- (void)hide:(CDVInvokedUrlCommand *)command
3030
{
31-
[self.viewController showLaunchScreen:NO];
31+
[self.viewController showSplashScreen:NO];
3232
}
3333

3434
@end

CordovaLib/Classes/Public/CDVCommandQueue.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Licensed to the Apache Software Foundation (ASF) under one
2121
#import <Cordova/CDVCommandQueue.h>
2222
#import <Cordova/CDVViewController.h>
2323
#import <Cordova/CDVPlugin.h>
24+
#import <Cordova/NSMutableArray+QueueAdditions.h>
2425
#import "CDVCommandDelegateImpl.h"
2526
#import "CDVJSON_private.h"
2627
#import "CDVDebug.h"

CordovaLib/Classes/Public/CDVViewController.m

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,13 @@ - (void)onWebViewPageDidLoad:(NSNotification*)notification
495495
CGFloat splashScreenDelaySetting = [self.settings cordovaFloatSettingForKey:@"SplashScreenDelay" defaultValue:0];
496496

497497
if (splashScreenDelaySetting == 0) {
498-
[self showLaunchScreen:NO];
498+
[self showSplashScreen:NO];
499499
} else {
500500
// Divide by 1000 because config returns milliseconds and NSTimer takes seconds
501501
CGFloat splashScreenDelay = splashScreenDelaySetting / 1000;
502502

503503
[NSTimer scheduledTimerWithTimeInterval:splashScreenDelay repeats:NO block:^(NSTimer * _Nonnull timer) {
504-
[self showLaunchScreen:NO];
504+
[self showSplashScreen:NO];
505505
}];
506506
}
507507
}
@@ -719,10 +719,12 @@ - (bool)checkAndReinitViewUrl
719719

720720
#pragma mark - API Methods for Plugins
721721

722-
/**
723-
Method to be called from the plugin JavaScript to show or hide the launch screen.
724-
*/
725722
- (void)showLaunchScreen:(BOOL)visible
723+
{
724+
[self showSplashScreen:visible];
725+
}
726+
727+
- (void)showSplashScreen:(BOOL)visible
726728
{
727729
CGFloat fadeSplashScreenDuration = [self.settings cordovaFloatSettingForKey:@"FadeSplashScreenDuration" defaultValue:250.f];
728730

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# ``Cordova``
2+
<!--
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one
5+
# or more contributor license agreements. See the NOTICE file
6+
# distributed with this work for additional information
7+
# regarding copyright ownership. The ASF licenses this file
8+
# to you under the Apache License, Version 2.0 (the
9+
# "License"); you may not use this file except in compliance
10+
# with the License. You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing,
15+
# software distributed under the License is distributed on an
16+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
# KIND, either express or implied. See the License for the
18+
# specific language governing permissions and limitations
19+
# under the License.
20+
#
21+
-->
22+
23+
Build your app using web technologies
24+
25+
## Overview
26+
27+
For more information about Apache Cordova, visit [https://cordova.apache.org](https://cordova.apache.org).
28+
29+
## Topics
30+
31+
### Using Cordova in your app
32+
33+
- ``CDVAppDelegate``
34+
- ``CDVViewController``
35+
36+
### Cordova plugins
37+
38+
- ``CDVPlugin``
39+
- ``CDVPluginResult``
40+
- ``CDVCommandStatus``
41+
- ``CDVInvokedUrlCommand``
42+
- ``CDVCommandDelegate``
43+
44+
### Web View plugins
45+
46+
- ``CDVWebViewEngineProtocol``
47+
- ``CDVWebViewEngineConfigurationDelegate``
48+
49+
### Utilities
50+
51+
- ``CDVSettingsDictionary``
52+
- ``CDVCommandQueue``
53+
- ``CDVConfigParser``
54+
- ``CDVTimer``
55+
56+
### Deprecated
57+
58+
- ``IsAtLeastiOSVersion``
59+
- ``CDVScreenOrientationDelegate``
60+
- ``CDVCommandStatus_NO_RESULT`` <!-- Swift alias -->
61+
- ``CDVCommandStatus_OK`` <!-- Swift alias -->
62+
- ``CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION`` <!-- Swift alias -->
63+
- ``CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION`` <!-- Swift alias -->
64+
- ``CDVCommandStatus_INSTANTIATION_EXCEPTION`` <!-- Swift alias -->
65+
- ``CDVCommandStatus_MALFORMED_URL_EXCEPTION`` <!-- Swift alias -->
66+
- ``CDVCommandStatus_IO_EXCEPTION`` <!-- Swift alias -->
67+
- ``CDVCommandStatus_INVALID_ACTION`` <!-- Swift alias -->
68+
- ``CDVCommandStatus_JSON_EXCEPTION`` <!-- Swift alias -->
69+
- ``CDVCommandStatus_ERROR`` <!-- Swift alias -->

CordovaLib/CordovaLib.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
7ED95D581AB9029B008C4574 /* NSDictionary+CordovaPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D321AB9029B008C4574 /* NSDictionary+CordovaPreferences.m */; };
8282
7ED95D591AB9029B008C4574 /* NSMutableArray+QueueAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D331AB9029B008C4574 /* NSMutableArray+QueueAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
8383
7ED95D5A1AB9029B008C4574 /* NSMutableArray+QueueAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D341AB9029B008C4574 /* NSMutableArray+QueueAdditions.m */; };
84+
902B30742C6C5A7E00C6804C /* CordovaLib.docc in Sources */ = {isa = PBXBuildFile; fileRef = 902B30732C6C5A7E00C6804C /* CordovaLib.docc */; };
85+
902B30752C6C5A7E00C6804C /* CordovaLib.docc in Sources */ = {isa = PBXBuildFile; fileRef = 902B30732C6C5A7E00C6804C /* CordovaLib.docc */; };
8486
9036843D2C6EB06500A3338C /* CDVAllowList.h in Headers */ = {isa = PBXBuildFile; fileRef = 9036843B2C6EB06500A3338C /* CDVAllowList.h */; };
8587
9036843E2C6EB06500A3338C /* CDVAllowList.m in Sources */ = {isa = PBXBuildFile; fileRef = 9036843C2C6EB06500A3338C /* CDVAllowList.m */; };
8688
9036843F2C6EB06500A3338C /* CDVAllowList.m in Sources */ = {isa = PBXBuildFile; fileRef = 9036843C2C6EB06500A3338C /* CDVAllowList.m */; };
@@ -193,6 +195,7 @@
193195
7ED95D331AB9029B008C4574 /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; };
194196
7ED95D341AB9029B008C4574 /* NSMutableArray+QueueAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+QueueAdditions.m"; sourceTree = "<group>"; };
195197
902D0BC12AEB64EB009C68E5 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
198+
902B30732C6C5A7E00C6804C /* CordovaLib.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = CordovaLib.docc; sourceTree = "<group>"; };
196199
9036843B2C6EB06500A3338C /* CDVAllowList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CDVAllowList.h; sourceTree = "<group>"; };
197200
9036843C2C6EB06500A3338C /* CDVAllowList.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CDVAllowList.m; sourceTree = "<group>"; };
198201
9047732D2C7A57E900373636 /* CDVURLSchemeHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CDVURLSchemeHandler.h; sourceTree = "<group>"; };
@@ -236,6 +239,7 @@
236239
0867D691FE84028FC02AAC07 = {
237240
isa = PBXGroup;
238241
children = (
242+
902B30732C6C5A7E00C6804C /* CordovaLib.docc */,
239243
9064EF5E26FAB74200C9D65B /* include */,
240244
7ED95D0E1AB9029B008C4574 /* Public */,
241245
7ED95CF11AB9028C008C4574 /* Private */,
@@ -567,6 +571,7 @@
567571
9052DE712150D040008E83D4 /* CDVAppDelegate.m in Sources */,
568572
9052DE722150D040008E83D4 /* CDVCommandDelegateImpl.m in Sources */,
569573
9052DE732150D040008E83D4 /* CDVCommandQueue.m in Sources */,
574+
902B30742C6C5A7E00C6804C /* CordovaLib.docc in Sources */,
570575
9052DE742150D040008E83D4 /* CDVConfigParser.m in Sources */,
571576
9052DE752150D040008E83D4 /* CDVInvokedUrlCommand.m in Sources */,
572577
9052DE762150D040008E83D4 /* CDVPlugin+Resources.m in Sources */,
@@ -598,6 +603,7 @@
598603
7ED95D371AB9029B008C4574 /* CDVAppDelegate.m in Sources */,
599604
7ED95D3C1AB9029B008C4574 /* CDVCommandDelegateImpl.m in Sources */,
600605
7ED95D3E1AB9029B008C4574 /* CDVCommandQueue.m in Sources */,
606+
902B30752C6C5A7E00C6804C /* CordovaLib.docc in Sources */,
601607
7ED95D401AB9029B008C4574 /* CDVConfigParser.m in Sources */,
602608
7ED95D421AB9029B008C4574 /* CDVInvokedUrlCommand.m in Sources */,
603609
7ED95D441AB9029B008C4574 /* CDVPlugin+Resources.m in Sources */,
@@ -685,6 +691,7 @@
685691
COPY_PHASE_STRIP = NO;
686692
DEBUG_INFORMATION_FORMAT = dwarf;
687693
DEFINES_MODULE = YES;
694+
DOCC_EXTRACT_SWIFT_INFO_FOR_OBJC_SYMBOLS = YES;
688695
ENABLE_MODULE_VERIFIER = YES;
689696
ENABLE_STRICT_OBJC_MSGSEND = YES;
690697
ENABLE_TESTABILITY = YES;
@@ -756,6 +763,7 @@
756763
COPY_PHASE_STRIP = NO;
757764
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
758765
DEFINES_MODULE = YES;
766+
DOCC_EXTRACT_SWIFT_INFO_FOR_OBJC_SYMBOLS = YES;
759767
ENABLE_MODULE_VERIFIER = YES;
760768
ENABLE_NS_ASSERTIONS = NO;
761769
ENABLE_STRICT_OBJC_MSGSEND = YES;

CordovaLib/include/Cordova/CDVCommandDelegate.h

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,67 @@ NS_ASSUME_NONNULL_BEGIN
2929
@protocol CDVCommandDelegate <NSObject>
3030

3131
@optional
32-
@property (nonatomic, nullable, copy) NSURL *(^urlTransformer)(NSURL *) CDV_DEPRECATED(8, "Unused");
32+
33+
@property (nonatomic, nullable, copy) NSURL *(^urlTransformer)(NSURL *) CDV_DEPRECATED(8, "");
3334

3435
@required
36+
/**
37+
The Cordova preferences for the web view.
38+
39+
This is a dictionary populated from the preference key/value pairs in the
40+
Cordova XML configuration file.
41+
*/
3542
@property (nonatomic, readonly) CDVSettingsDictionary* settings;
3643

37-
- (NSString*)pathForResource:(NSString*)resourcepath;
38-
- (id)getCommandInstance:(NSString*)pluginName;
39-
40-
// Sends a plugin result to the JS. This is thread-safe.
41-
- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId;
42-
// Evaluates the given JS. This is thread-safe.
43-
- (void)evalJs:(NSString*)js;
44-
// Can be used to evaluate JS right away instead of scheduling it on the run-loop.
45-
// This is required for dispatch resign and pause events, but should not be used
46-
// without reason. Without the run-loop delay, alerts used in JS callbacks may result
47-
// in dead-lock. This method must be called from the UI thread.
48-
- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop;
49-
// Runs the given block on a background thread using a shared thread-pool.
44+
- (NSString *)pathForResource:(NSString *)resourcepath;
45+
46+
/**
47+
Returns the CDVPlugin instance of the given plugin name.
48+
49+
- Parameters:
50+
- pluginName: The name of the plugin to return.
51+
- Returns: The ``CDVPlugin`` instance, or `nil` if no plugin instance was
52+
found with the given name.
53+
*/
54+
- (nullable CDVPlugin *)getCommandInstance:(NSString *)pluginName;
55+
56+
/**
57+
Sends a plugin result to the web view. This is thread-safe.
58+
59+
- Parameters:
60+
- result: The plugin result to send to the web view.
61+
- callbackId: The ID of the JavaScript callback to invoke.
62+
*/
63+
- (void)sendPluginResult:(CDVPluginResult *)result callbackId:(NSString *)callbackId;
64+
65+
/**
66+
Evaluates the given JavaScript string in the web view. This is thread-safe.
67+
68+
- Parameters:
69+
- js: The string of JavaScript code to run.
70+
*/
71+
- (void)evalJs:(NSString *)js;
72+
73+
/**
74+
Evaluates the given JavaScript string right away instead of scheduling it on
75+
the run-loop.
76+
77+
This is required for dispatching `resign` and `pause` events, but should not
78+
be used without reason. Without the run-loop delay, alerts used in JS callbacks
79+
may result in dead-lock. This method must be called from the UI thread.
80+
81+
- Parameters:
82+
- js: The string of JavaScript code to run.
83+
- scheduledOnRunLoop: Whether to schedule the code to run on the run-loop.
84+
*/
85+
- (void)evalJs:(NSString *)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop;
86+
87+
/**
88+
Runs the given block on a background thread using a shared thread-pool.
89+
90+
- Parameters:
91+
- block: The block to be run.
92+
*/
5093
- (void)runInBackground:(void (^)(void))block;
5194

5295
@end

CordovaLib/include/Cordova/CDVPlugin.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#import <UIKit/UIKit.h>
2222
#import <Cordova/CDVAvailabilityDeprecated.h>
2323
#import <Cordova/CDVPluginResult.h>
24-
#import <Cordova/NSMutableArray+QueueAdditions.h>
2524
#import <Cordova/CDVCommandDelegate.h>
2625
#import <Cordova/CDVSettingsDictionary.h>
2726
#import <Cordova/CDVViewController.h>

CordovaLib/include/Cordova/CDVPluginResult.h

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,42 @@
2020
#import <Foundation/Foundation.h>
2121
#import <Cordova/CDVAvailability.h>
2222

23+
/**
24+
An enumeration that describes the result of handling a plugin command.
25+
26+
## See Also
27+
28+
- ``CDVPluginResult``
29+
*/
2330
typedef NS_ENUM(NSUInteger, CDVCommandStatus) {
31+
/** Status code indicating no command result. */
2432
CDVCommandStatus_NO_RESULT NS_SWIFT_NAME(noResult) = 0,
33+
34+
/** Status code indicating successful handling of the command. */
2535
CDVCommandStatus_OK NS_SWIFT_NAME(ok),
36+
37+
/** Status code indicating the command's plugin class could not be found. */
2638
CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION NS_SWIFT_NAME(classNotFoundException),
39+
40+
/** Status code indicating there was an illegal access exception while handling the command. */
2741
CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION NS_SWIFT_NAME(illegalAccessException),
42+
43+
/** Status code indicating the command's plugin class could not be instantiated. */
2844
CDVCommandStatus_INSTANTIATION_EXCEPTION NS_SWIFT_NAME(instantiationException),
45+
46+
/** Status code indicating the command included a malformed URL. */
2947
CDVCommandStatus_MALFORMED_URL_EXCEPTION NS_SWIFT_NAME(malformedUrlException),
48+
49+
/** Status code indicating there was an I/O exception while handling the command. */
3050
CDVCommandStatus_IO_EXCEPTION NS_SWIFT_NAME(ioException),
51+
52+
/** Status code indicating the command's action was not valid. */
3153
CDVCommandStatus_INVALID_ACTION NS_SWIFT_NAME(invalidAction),
54+
55+
/** Status code indicating the command's JSON data was invalid. */
3256
CDVCommandStatus_JSON_EXCEPTION NS_SWIFT_NAME(jsonException),
57+
58+
/** Status code indicating there was an error handling the command. */
3359
CDVCommandStatus_ERROR NS_SWIFT_NAME(error)
3460
};
3561

@@ -59,11 +85,9 @@ NS_ASSUME_NONNULL_BEGIN
5985
@interface CDVPluginResult : NSObject {}
6086

6187
@property (nonatomic, strong, readonly) NSNumber *status;
62-
@property (nonatomic, strong, readonly) id message;
63-
@property (nonatomic, strong) NSNumber *keepCallback;
64-
// This property can be used to scope the lifetime of another object. For example,
65-
// Use it to store the associated NSData when `message` is created using initWithBytesNoCopy.
66-
@property (nonatomic, strong) id associatedObject;
88+
@property (nonatomic, nullable, strong, readonly) id message;
89+
@property (nonatomic, strong) NSNumber *keepCallback;
90+
@property (nonatomic, strong) id associatedObject CDV_DEPRECATED(8, "");
6791

6892
- (instancetype)init;
6993
+ (instancetype)resultWithStatus:(CDVCommandStatus)statusOrdinal;
@@ -79,8 +103,8 @@ NS_ASSUME_NONNULL_BEGIN
79103
+ (instancetype)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray *)theMessages;
80104
+ (instancetype)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode;
81105

82-
+ (void)setVerbose:(BOOL)verbose;
83-
+ (BOOL)isVerbose;
106+
+ (void)setVerbose:(BOOL)verbose CDV_DEPRECATED(8, "");
107+
+ (BOOL)isVerbose CDV_DEPRECATED(8, "");
84108

85109
- (void)setKeepCallbackAsBool:(BOOL)bKeepCallback;
86110

CordovaLib/include/Cordova/CDVScreenOrientationDelegate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#import <Foundation/Foundation.h>
2121
#import <Cordova/CDVAvailabilityDeprecated.h>
2222

23-
CDV_DEPRECATED(8, "Unused")
23+
CDV_DEPRECATED(8, "")
2424
@protocol CDVScreenOrientationDelegate <NSObject>
2525

2626
- (UIInterfaceOrientationMask)supportedInterfaceOrientations;

0 commit comments

Comments
 (0)