Is there API to get the default interface name in route table

There's a command can output the defautl interface name like this:

$route -n get default

route to: default

destination: default

mask: default

gateway: 169.38.24.11

interface: en0

flags: <UP,GATEWAY,DONE,STATIC,PRCLONING>

recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire

0 0 0 0 0 0 1500 0


I want to know if there's API in macOS xcode/SDK to get the interface name: en0 in below output?