I have integrated Swift Crypto, the example shows how to generate a new private key\public key, then sign.
let signingKey = try P256.Signing.PrivateKey()
let signature = try signingKey.signature(for: hash)
but I want to use a given privatekey, just like the code in nodejs
import { ecsign} from 'ethereumjs-util';
const { r, s, v } = ecsign(hash, Buffer.from(givenPivatekey, 'hex'));
const signature = Buffer.concat([ r, s ]);
so what's the solution