Since I am writing a function that takes two positive integers, it would be wise to guard against negative values. After that, I think I would iterate through all possible cominations of numbers that would add up to the sum, and try multiplying them to see if they equal the product. I should divide the sum by two so that I start at the smallest integers before working my way outward, as the instructions are asking for the two smallest positive integers. I would then return an array with the two numbers, with the smaller one preceeding the larger one. This may likely be a very naive solution and may be quite inneficient with some input cases, but it should work.
func sumAndProduct(_ sum: Int, _ product: Int) -> [Int] {
// First off, let's guard against non-positive integers
guard sum > 0, product > 0 else { return [] }
// If the sum is odd, dividing by 2 will result in x rounding down
var x = sum / 2
// So then we will take the sum and subtract x to get y