Advertisement
applehelpwriter

toggle Swift Compiler warnings

Jul 15th, 2017
908
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ###########################################################
  2. -->> ABOUT
  3. ###########################################################
  4. (*
  5.  
  6.  Phil Stokes -- 2017
  7.  applehelpwriter.com
  8.  sqwarq.com
  9.    
  10.  See: http://applehelpwriter.com/2017/07/15/toggle-swift-compiler-warnings/
  11.  
  12. *)
  13. ###########################################################
  14. -->> DESCRIPTION
  15. ###########################################################
  16. (*
  17.  
  18. This script toggles Xcode's Swift compiler warnings for Debug builds on and off.
  19.  
  20.  
  21. *)
  22. ###########################################################
  23. -->> USAGE
  24. ###########################################################
  25. (*
  26.  
  27. Best made into a Service or executed from a script runner like FastScripts or Keyboard Maestro
  28.  
  29.  
  30. *)
  31. ###########################################################
  32. -->> IMPORT STATEMENTS
  33. ###########################################################
  34.  
  35. use AppleScript version "2.4" -- Yosemite (10.10) or later
  36. use scripting additions
  37.  
  38. ###########################################################
  39. -->> HANDLERS
  40. ###########################################################
  41.  
  42.  
  43. on sendNotification(aVal)
  44.    
  45.     display notification "Suppress Warnings was set to " & aVal with title "Swift Compiler - Warnings Policies"
  46.    
  47. end sendNotification
  48. ###########################################################
  49. -->> COMMANDS
  50. ###########################################################
  51.  
  52. tell application id "com.apple.dt.Xcode"
  53.     tell its front document
  54.         tell its front project
  55.             tell its front target
  56.                 tell its build configuration "Debug"
  57.                     set b to build setting "SWIFT_SUPPRESS_WARNINGS"
  58.                     if b's value is "NO" then
  59.                         set b's value to "YES"
  60.                     else
  61.                         set b's value to "NO"
  62.                     end if
  63.                     my sendNotification(b's value)
  64.                 end tell
  65.             end tell
  66.         end tell
  67.     end tell
  68. end tell
  69.  
  70. #EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement