Scott

A running list of weird Swift things I encounter.

These are a few ideas for interview questions that explore some of the odd nuances of swift?

What will the following code print?

class Bla {
var closure1: Action?
var closure2: Action?
}
let bla = Bla()
bla.closure1 = {
print("hello 1")
}
bla.closure2 = bla.closure1bla.closure1 = {
print("successful interception")
}
bla.closure2?()

At first it seems as though it might print “successful interception”. However, it actually prints “hello 1”.

class Bla {
var closure1: Action?
var closure2: Action?
}
let bla = Bla()
bla.closure1 = {
print("hello 1")
}
bla.closure2 = {
bla.closure1?()
}
bla.closure1 = {
print("successful interception")
}
bla.closure2?()

It doesn’t seem like this change would do much, but now it prints “successful interception.”

--

--

git status Get a visual of current changes. red changes are unstaged changes. Green changes are staged changes.

I use the following to clear all changes

git reset Unstage your changes

git checkout .

git checkout -- .

git clean -f -fd -fx

--

--

git checkout develop
git pull upstream develop --rebase
git checkout -b yourBranch
git push upstream yourBranch
git branch -u upstream/yourBranch yourBranchgit rebase develop

Before you push

git rebase develop

You should pull the latest develop into your branch before merging, so that you can create a merge commit which will run the latest develop ci functionality in your pr as well.

--

--