77import sysconfig
88import zipfile
99from importlib import resources
10+ from typing import Any , Dict , List , Optional
1011
1112
1213def init_project (args : argparse .Namespace ) -> None :
@@ -284,7 +285,7 @@ def run_project(args: argparse.Namespace) -> None:
284285 derived_data = os .path .join (ios_project_dir , "build" )
285286 try :
286287 # Detect a simulator UDID to target: prefer Booted; else any iPhone
287- sim_udid : str | None = None
288+ sim_udid : Optional [ str ] = None
288289 try :
289290 import json as _json
290291
@@ -294,21 +295,25 @@ def run_project(args: argparse.Namespace) -> None:
294295 capture_output = True ,
295296 text = True ,
296297 )
297- devs = ( _json .loads (devices_out .stdout or "{}" ).get ("devices" ) or {})
298+ devs = _json .loads (devices_out .stdout or "{}" ).get ("devices" ) or {}
298299 all_devs = [d for lst in devs .values () for d in (lst or [])]
299300 for d in all_devs :
300301 if d .get ("state" ) == "Booted" :
301302 sim_udid = d .get ("udid" )
302303 break
303304 if not sim_udid :
304305 for d in all_devs :
305- if (d .get ("isAvailable" ) or d .get ("availability" )) and (d .get ("name" ) or "" ).lower ().startswith ("iphone" ):
306+ if (d .get ("isAvailable" ) or d .get ("availability" )) and (
307+ d .get ("name" ) or ""
308+ ).lower ().startswith ("iphone" ):
306309 sim_udid = d .get ("udid" )
307310 break
308311 except Exception :
309312 pass
310313
311- xcode_dest = ["-destination" , f"id={ sim_udid } " ] if sim_udid else ["-destination" , "platform=iOS Simulator" ]
314+ xcode_dest = (
315+ ["-destination" , f"id={ sim_udid } " ] if sim_udid else ["-destination" , "platform=iOS Simulator" ]
316+ )
312317
313318 subprocess .run (
314319 [
@@ -361,7 +366,7 @@ def run_project(args: argparse.Namespace) -> None:
361366 text = True ,
362367 )
363368 devices_json = _json .loads (result .stdout or "{}" )
364- all_devices = []
369+ all_devices : List [ Dict [ str , Any ]] = []
365370 for _runtime , devices in (devices_json .get ("devices" ) or {}).items ():
366371 all_devices .extend (devices or [])
367372 # Prefer iPhone 15/15 Pro names; else first available iPhone
0 commit comments