Akinon Plugin Adapter
Akinon Plugin Adapter offers services to improve plugin development processes. Upon installing a project with the appmaker cli, the akinon-plugin-adapter package comes ready to use and is compatible with the env version of the project.
Modifiers
AppDelegateModifier
It contains the required functions for editing AppDelegate.m and AppDelegate.h files.
Usage
const { Modifiers, Paths } = require('akinon-plugin-adapter');
const { AppDelegateModifier } = Modifiers;
const { ios: { getAppDelegate } } = Paths;
const appDelegate = new AppDelegateModifier(getAppDelegate());Methods
addImports(imports, options)
Params
imports (required)
array []
The imports that need to be added are sent in string format.
options (optional)
object {}
-
options
Example
Return
Returns the final version of the app delegate file in string format.
addFunctions(functions)
Params
functions (required)
array []
The functions that need to be added are sent in object format.
functions
Example
Return
Returns the final version of the app delegate file in string format.
patchDidFinishLaunch(patch)
Params
patch (required)
string ""
The code that needs to be added to the didFinishLaunchingWithOptions function is sent in string format.
Example
Return
Returns the final version of the app delegate file in string format.
patchFunction(params)
Patches a current function in the AppDelegate file.
Params
params (required)
object {}
Patches a current function in the AppDelegate file
params
Example
Return
Returns the final version of the app delegate file in string format.
writeAsync
Writes the current version of the AppDelegate file to disk.
Example
Return
Return a promise
XcodeModifier
It parses the Xcode file into javascript. Edits are made on xcode with javascript functions, with its output also in xcode format.
Usage
Methods
parse()
It parses the Xcode file within ./ios/akinon.xcodeproj/project.pbxproj directory into javascript. Make sure the parse method is running before using xcode methods.
Usage
writeAsync()
Rebuilds the xcode objects that has been parsed into javascript object into xcode file and writes this to ./ios/akinon.xcodeproj/project.pbxproj directory.
Usage
getFirstProject()
Return PBXProject section
Usage
getPbxGroup()
Brings references to files and folders registered to the akinon group.
Usage
getApplicationTarget()
Returns akinon target. It’s useful to access akinon target's build settings and build phase references.
getPbxBuildFile(fileName)
Returns the reference of the related file witin files in the akinon group.
Params
fileName (required)
string ""
-
Usage
createFile(file, groupName)
Adds a new file to akinon target.
Params
file (required)
Object {}
-
groupName (optional)
String ""
The name of the group where the file is desired to be added
file
Return
Returnd created file information as object.
addFileToTarget(file, target)
Add a file’s reference to the specified target. It’s useful to add a file to targets that have been added later on.
Params
file (required)
Object {}
-
target (required)
String ""
Target UUID
file
addFrameworks(frameworks)
Adds framework to akinon target.
Params
frameworks (required)
Array []
Please define the frameworks you wish to add in string format.
Usage
addExtension(extension)
Adds new extension and extension files to akinon project. It’s useful to add extensions such as Notification Service Extension and Notification Content Extension.
Params
extension (required)
Object {}
This sends the information of the extension you wish to add to the akinon project.
Usage
addBuildPhase(files, type, comment, targetId)
Adds new fields and files to the Build Phases section of the specified target.
Params
files
Array []
Specify the files that need to be added during build phase in the string format.
type (required)
String ""
Build phase type. Example PBXSourcesBuildPhase
comment (required)
String ""
Build phase name. Example Sources
targetId (required)
String ""
Target uuid
Usage
addAttributeToTarget(attribute, value, target)
Adds new attribute to the specified target object. It’s useful for build configs that need to be added to a newly created target.
Params
attribute (required)
String ""
Name of the new config to be added to target. Example: LastSwiftMigration
value (required)
*
New config value to be added to target. Example: 1240
target (required)
Object {}
Target object
Usage
updateBuildSettings(configName, value, targetName)
It’s useful to update a current build config in the specified target.
Params
configName (required)
String ""
Build config name
value (required)
*
Build config value
targetName (required)
String""
Target name
Usage
generateUuid();
Returns a unique id.
Usage
pbxBuildFileSection();
Returns the references of the files in the akinon group.
Usage
Return
Returns build files as object. Objectstring, BuildFileSection>>
addPbxGroup(extensionFiles, name, path);
It’s used to create a new group.
Params
extensionFiles (required)
Array []
Specify the files that need to added to group in string format.
name (required)
String ""
Group Name
path (required)
String""
Group Path
Usage
Return
Returns the created PbxGroup as object.
{uuid: string, pbxGroup: PbxGroup }
addToPbxGroup(file, groupKey);
It’s used to add a new file to the specified group. It’s useful to add a new file to group.
Params
file (required)
String ""
File uuid
groupKey (required)
String ""
Group uuid
Usage
addToPbxFileReferenceSection(file);
Creates the file reference of the sent file.
Params
file (required)
Object {}
-
file
Usage
addToPbxBuildFileSection(file);
Adds the sent file to build file section.
Params
file (required)
Object {}
-
Usage
addToPbxResourcesBuildPhase(file)
Adds the specified file to Build Phases section.
Params
file (required)
Object {}
-
Usage
addFramework(framework, options);
Adds a new framework to target.
Params
params (required)
String ""
Please define the frameworks you wish to add.
options (required)
Object {}
Options
options
Usage
Return
Returns the added framework as object. PbxFile
addTarget(name, type);
Adds new Target to project.
Params
name (required)
String ""
Target Name
type (required)
String ""
Target Type
Usage
Return
Returns the added target as object.
{uuid: string, pbxNativeTarget: Target}
pbxXCConfigurationList();
Return XCConfigurationList
Usage
Return
Returns XCConfigurationLists as object. Objectstring, XCConfigurationList>>
pbxXCBuildConfigurationSection();
Return XCBuildConfiguration section.
Usage
Return
Returns XCBuildConfiguration as object. Objectstring, XCBuildConfiguration
pbxNativeTargetSection();
Return PBXNativeTarget section.
Usage
Returns PBXNativeTarget as object. Objectstring, Target>>
addToLibrarySearchPaths(file);
Adds the specified file to Library Search Paths in the akinon target.
Params
file (required)
String "" | Object {}
The file to be added to Library Search Paths
file (object)
Usage
addToHeaderSearchPaths(file);
Adds the specified file to the Header Search Paths of Targets.
Params
file (required)
String "" | Object {}
The file to be added to Header Search Paths
file (object)
Usage
removeFromHeaderSearchPaths(file);
Removes the specified file from the Header Search Paths of Targets.
Params
file (required)
Object {}
The file to be removed from Header Search Paths
file (object)
Usage
addToOtherLinkerFlags(flag);
Adds the specified flag to the Other Linker Flags of Targets.
Params
flag (required)
String""
The flag to be added to Other Linker Flags
Usage
removeFromOtherLinkerFlags(flag);
Removes the specified flag from the Other Linker Flags of Targets.
Params
flag (required)
String""
The flag to be removed from Other Linker Flags
Usage
addToBuildSettings(setting, value);
Adds the specified setting to the Build Settings of Targets.
Params
setting (required)
String""
The key for the setting to be added to Build Settings
value(required)
String""
The value for the setting to be added to Build Settings
Usage
removeFromBuildSettings(setting, value);
Removes the specified setting from the Build Settings of Targets.
Params
setting (required)
String""
The key for the setting to be removed from Build Settings
Usage
productName
Projenin product name’ini return eder.
Usage
hasFile(filePath)
Checkes whether file path has file reference.
Params
filePath (required)
String""
The path of the file to be checked
Usage
Return
If the file is not found within the file references, it returns false; if it is found, it returns the file reference.
getFirstTarget()
Returns the first target within project.
Usage
Return
Returns the first found target as object.
{uuid: string: firstTarget: Target}
getTarget(type);
Fetches the first target that belongs to type from among the targets within project.
Params
type (required)
String""
Product type to be fetched
Usage
Return
Returns the first target obtained from type-specific filtering from among the targets within project, as object.
{uuid: string, target: Target}
addToPbxGroupType(file, key, type);
Adds file to the type that belongs to the specified group.
Params
file (required)
String""
File uuid
key (required)
String""
Group key
type (required)
String""
Group type
Usage
addToPbxVariantGroup(file, key);
removeFromPbxFrameworksBuildPhase(file)
Removes the sent file from the build phase named Frameworks.
Params
file (required)
PBXFile
-
Usage
addToPbxFrameworksBuildPhase(file)
Adds the sent file to the build phase named Frameworks.
Params
file (required)
PBXFile
-
Usage
removeFromPbxResourcesBuildPhase(file)
Removes the sent file from the build phase named Copy Bundle Resources.
Params
file (required)
PBXFile
-
Usage
addToPbxResourcesBuildPhase(file)
Adds the sent file to the build phase named Copy Bundle Resources.
Params
file (required)
PBXFile
-
Usage
removeFromPbxSourcesBuildPhase(file)
Removes the sent file from the build phase named Compile Sources.
Params
file (required)
PBXFile
-
Usage
addToPbxSourcesBuildPhase(file)
Adds the sent file to the build phase named Compile Sources.
Params
file (required)
PBXFile
-
Usage
removeFromProductsPbxGroup(file)
Removes the sent file from the pbx group named Products.
Params
file (required)
PBXFile
-
Usage
addToProductsPbxGroup(file)
Adds the sent file to the pbx group named Products.
Params
file (required)
PBXFile
-
Usage
removeFromPbxEmbedFrameworksBuildPhase(file)
Removes the sent file from the build phase named Embed Frameworks.
Params
file (required)
PBXFile
-
Usage
addToPbxEmbedFrameworksBuildPhase(file)
Adds the sent file to the build phase named Embed Frameworks.
Params
file (required)
PBXFile
-
Usage
removeFromFrameworksPbxGroup(file);
Removes the sent file from the pbx group named Frameworks.
Params
file (required)
PBXFile
-
Usage
addToFrameworksPbxGroup(file);
Adds the sent file to the pbx group named Frameworks.
Params
file (required)
PBXFile
-
Usage
removeFromResourcesPbxGroup(file);
Removes the sent file from the pbx group named Resources.
Params
file (required)
PBXFile
-
Usage
addToResourcesPbxGroup(file);
Adds the sent file to the pbx group named Resources.
Params
file (required)
PBXFile
-
Usage
removeFromPluginsPbxGroup(file);
Removes the sent file from the pbx group named Plugin.
Params
file (required)
PBXFile
-
Usage
addToPluginsPbxGroup(file);
Adds the sent file to the pbx group named Plugins.
Params
file (required)
PBXFile
-
Usage
removeFromPbxFileReferenceSection(path)
Removes the file in the specified target from PbxFileReferenceSection.
Param
path (required)
string
Path of the file to be added
Usage
Return
Returns the deleted file PBXFile
removePbxGroup(name);
Removes the specified group.
Params
name (required)
string
-
Usage
removeFromPbxBuildFileSection(file);
Removes the sent file from the build file section.
Params
file (required)
PBXFile
-
Usage
addStaticLibrary(path, options)
Adds the file in the specified target as static library.
Param
path (required)
string
Path of the file to be added
options
object{}
-
**options **
Usage
Return
Returns the added file PBXFile
removeFromPbxCopyfilesBuildPhase(file)
Removes the specified file from within files in the CopyfilesBuildPhase object.
Param
file (required)
pbxFile
File to be deleted
Usage
removeCopyfile(path, options)
Returns the CopyfilesBuildPhase object in the specified target.
Param
path (required)
string
Path of the file to be deleted
options
object{}
-
options
Usage
Return
Returns the removed file PBXFile
addToPbxCopyfilesBuildPhase(file)
Adds the specified file to files within the CopyfilesBuildPhase object.
Param
file (required)
pbxFile
File to be added
Usage
pbxCopyfilesBuildPhaseObj(target)
Returns the CopyfilesBuildPhase object in the specified target
Param
target (required)
string
Target uuid
Usage
Return
Returns deleted object PBXCopyFilesBuildPhase
addCopyfile(path, options)
ToDo: Method could not be run
removeFramework(path, options)
Removes the file in the specified path from within Frameworks.
Param
path (required)
string
Path of the file to be added
options (optional)
Object{}
-
options
Usage
Return
Returns the reference of the removed file.
removeResourceFile(path, options, group)
Removes the specified resource file from a group.
Param
path (required)
string
Path of the file to be removed
options (optional)
Object{}
-
group (optional)
string
Group where the file will be removed
options
Usage
Return
Returns the reference of the removed file.
addResourceFile(path, options, group)
Adds the specified resource file to a group.
Param
path (required)
string
Path of the file to be added
options (optional)
Object{}
-
group (optional)
string
Group where the file will be added
options
Usage
Return
Returns the reference of the added file.
removeHeaderFile(path, options, group)
Removes the specified header file from a group.
Param
path (required)
string
Path of the file to be removed
options (optional)
Object{}
-
group (optional)
string
Group where the file will be removed
options
Usage
Return
Returns the reference of the deleted file.
addHeaderFile(path, options, group)
Adds the specified header file to a group.
Param
path (required)
string
Path of the file to be added
options (optional)
Object{}
-
group (optional)
string
Group where the file will be added
options
Usage
Return
Returns the reference of the added file.
removeSourceFile(path, options, group)
Removes the path source code from the specified group.
Param
path (required)
string
Path of the file to be removed
options (optional)
Object{}
-
group (optional)
string
Group where the file will be removed
options
Usage
Return
Returns the reference of the deleted file.
addSourceFile(path, options, group)
Adds the path source code to the specified group.
Param
path (required)
string
Path of the file to be added
options (optional)
Object{}
-
group (optional)
string
Group where the file will be added
options
Usage
Return
Returns the reference of the added file.
removeProductFile(path, options)
Removes the file in the specified path from products in the project.
Params
path (required)
string
Path of the file to be deleted
options (optional)
Object{}
-
options
Usage
Return
Returns the reference of the deleted file.

