Documentation or explanation for keyword 'in' as used in function arguments

I am learning Swift and trying to find information about what the keyword 'in' does when used in a function argument as in these examples:

func fillEllipse(in rect: CGRect)
func drawSomething(in rect: CGRect, in context: CGContext, 
                   with colorSpace: CGColorSpace?)

From the context, I gather that it essentially means put the ellipse in a rectangle, draw something in a rectangle, in a context, etc. but what is actually happening when 'in' is used like this? Is it related to closures, or something else?

In Xcode, option-click on 'in' doesn't provide any information, and I haven't been able to find any explanations of this usage on the internet.

I've been reading about anonymous functions so I guess I just started thinking that it was related. Thanks!

Maybe this should have been my original question. Here is an example from a book I'm trying to understand. The topic is transforming a function into an anonymous function. What is 'in' in this situation?

Named function:

func whatToDoLater(finished:Bool) { 
    print("finished: \(finished)")
}

Anonymous function:

{
   (finished:Bool) -> () in 
   print("finished: \(finished)")
}