• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: OT: Swift Code Autoformatter?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT: Swift Code Autoformatter?


  • Subject: Re: OT: Swift Code Autoformatter?
  • From: sqwarqDev <email@hidden>
  • Date: Fri, 15 Jan 2016 17:38:14 +0700

> On 15 Jan 2016, at 03:36, Charles Jenkins <email@hidden> wrote:
>
> there’s no way for the end user to create them.


A combination of AppleScript, sed and awk will pretty much do anything you can imagine in terms of text formatting, and they’re all included on you mac already; no need for 3rd party apps.

With a project and source document already open, doing this in the (Apple)Script Editor will get your code into the editor, where you can then transform it any way you like before sending it back:


tell application "Xcode"
	tell source document 1
		set _sourceCode to contents

		-- do shell script ....//do all your formatting here



		-- replace the original code with your formatted changes
		set contents to _sourceCode
	end tell
end tell



Best


Phil
@sqwarqdev
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: OT: Swift Code Autoformatter?
      • From: sqwarqDev <email@hidden>
    • Re: OT: Swift Code Autoformatter?
      • From: Charles Jenkins <email@hidden>
References: 
 >OT: Swift Code Autoformatter? (From: Charles Jenkins <email@hidden>)

  • Prev by Date: Re: OT: Swift Code Autoformatter?
  • Next by Date: Re: drawRect: wrong scale in a programmatically created window
  • Previous by thread: Re: OT: Swift Code Autoformatter?
  • Next by thread: Re: OT: Swift Code Autoformatter?
  • Index(es):
    • Date
    • Thread