You can write Swift code to collect the gem and turn around using conditional statements. For example, you can use an "if" statement to check if your character is blocked and on a gem, and then use the "collectGem()" and "turnAround()" commands within the same block of code. Here's an example:
if isBlocked && isOnGem {
collectGem()
turnAround()
}