How to change text field placeholder color from storyboard .
select the UITextfiled of which you want to change the color. if there are several text fields, you have to do the same procedure for each.
open the identity inspector. see the pic.
Find the User Defined Runtime Attributes and click + button.
Type a new row with Key Path placeholderLabel.textColor. be reminded that this is for iOS13, Swift 5.0. if it is for lower version, type _placeholderLabel.textColor instead.
choose Type color and select the color as your choice.
The views belonging to the presenting view controller are removed after the presentation completes.
.overFullScreen
Discussion
The views beneath the presented content are not removed from the view hierarchy when the presentation finishes. So if the presented view controller does not fill the screen with opaque content, the underlying content shows through.
Function Type
swift can show the type of the return value of a function.
This could be useful when implementing type matching by swift, so it is necessary to see the details of this.
The function in the example below is called greet(person:), because that’s what it does—it takes a person’s name as input and returns a greeting for that person. To accomplish this, you define one input parameter—a String value called person—and a return type of String, which will contain a greeting for that person:
funcgreet(person: String) -> String {
letgreeting = "Hello, " + person + "!"
returngreeting
}
typealias
This will create obviously the alias of a type.
typealias (String) -> String = greetType
func callGreet(callback: greetType) {
letgreeting = callback("Hello")
// this is supposed to be greet(person: String) function
returngreeting
}
Filter
Returns an array containing, in order, the elements of the sequence that satisfy the given predicate.
letnumbers = [1,2,3,4,5]
letgreaterThan2 = numbers.filter { $0 > 2}
print(greaterThan2)
[3, 4, 5]
Map
Returns an array containing the results of mapping the given closure over the sequence’s elements.
letcast = ["Vivien", "Marlon", "Kim", "Karl"]
letlowercaseNames = cast.map { $0.lowercased() }
print(lowercaseNames)
["vivien", "marlon", "kim", "karl"]
letletterCounts = cast.map { $0.count }
print(letterCounts)
[6, 6, 3, 4]
Reduce
Returns the result of combining the elements of the sequence using the given closure.
let s1 ='2 + 2'// creates a string primitivelet s2 =newString('2 + 2')// creates a String object
console.log(eval(s1))// returns the number 4
console.log(eval(s2))// returns the string "2 + 2"
String primitives and String objects String primitives and String objects also give different results when using eval(). Primitives passed to eval are treated as source code; String objects are treated as all other objects are ref
It can be installed from Micosoft store but it is still preview.
I think i want to try to build from the source though,
the preview version is already comfortable and i feel really happy with it.