Author: Blogger
-
How to include local modules in Node.js application?
We can export the modules that we create locally in other files and folders. This can be done by using module.exports . We have to import the specific file in which the local module is located by using require keyword.
-
How to include core modules in you Node.js application ?
Node.js core modules such as fs(file system) , http, url etc… has to be imported into the program file using the require key word.
-
How to create a tableview programatically in Swift?
We can create a tableview programatically in Swift with the following lines of code.
-
Purpose of register(_:forCellReuseIdentifier) function in Swift
The main purpose of the register(_:forCellReuseIdentifier) function is to tell the tableview how to create new cells prior to dequeuing cells. If the cell of specified type is not currently in the reuse queue, tableview automatically creates cell of the specified type. Parameters: cellClass : The class of cell that we want to use in tableview.(UITableView […]
-
How to create an array in Swift 4 with a default value?
Syntax: Array(repeating: 35.0, count: 5) We can create an array with default values using the above syntax.
-
Swift: Recursive enumeration
Recursive enumeration in Swift is a enumeration which has a instance of another enumeration as one of the associated values of the enumeration cases. We indicate recursive enumerations with the keyword indirect. If all the cases in the enumeration has one or more instance of another enumeration, the keyword indirect can be place in the enum definition itself. […]
-
Swift: Initializing from rawValue
When we define a enumeration with a raw value type, Swift provides a default initializer that takes the value of that type’s raw value as a parameter and return a enumeration case or nil. Not all raw values will find a matching case in enumeration. Swift code
-
Swift: Implicitly assigned rawValues
In enumerations, we can provide default value for the cases. The values must be of same type. If we are to provide String values and Int values as default values to the enum cases, we don’t have to explicitly provide them.Swift can implicitly assign raw values for the enum cases.For string type, the name provided […]