Sorry, but I'm not ready to share the code yet. But I can share code for launching ipfs node, if necessary.
I'm launching ipfs node from code, but i've tried the same configuration as with profile=lowpower. 20-40 connections appeared to be too much for iOS. I've tried to launch daemon with 5 and 10 connections for low and high water conditions, but still not good.
I've also observed that even with connections limits my node has more connections then I specified in ConnMgr.HighWater. Up to 40 connections after launch for 10 high water limit. I'm launching my node with pubsub and ipnsps activated. Maybe, that's the case.
EDIT: looks like with ipnsps disabled, swarm respects connections limit.