(iOS/OSX) Make frontend code more generic