Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jlyonsmith/csharp_2_swift
A tool for doing rough conversion of C# code to Swift
https://github.com/jlyonsmith/csharp_2_swift
Last synced: 6 days ago
JSON representation
A tool for doing rough conversion of C# code to Swift
- Host: GitHub
- URL: https://github.com/jlyonsmith/csharp_2_swift
- Owner: jlyonsmith
- License: mit
- Created: 2015-12-30T22:31:11.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-12T03:41:44.000Z (almost 9 years ago)
- Last Synced: 2023-03-17T16:35:26.833Z (over 1 year ago)
- Language: C#
- Size: 31.3 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Simple C# to Swift Converter
This is a simple Ruby tool to aid in the conversion of C# to Swift.
Unlike most of the commercial tools that I have tried, such as [Oxidizer](http://docs.elementscompiler.com/Tools/Oxidizer/) this tool is designed to be used one file at a time.
Because no tool is yet powerful enough to truly convert an entire project without programmer assistance I wanted something that would get me 80% of the way there by dealing with most of the typing intensive tasks, letting me focus on the framework related issues.
Install the tool with:
```bash
gem install csharp_2_swift
```**IMPORTANT:** You need to untabify your source code before running the tool. For now, `csharp_2_swift` assumes multiples of 4 spaces as the indentation level. You can use `spacer` from my [code_tools](https://rubygems.org/gems/code_tools) Gem to achieve that, like so:
```bash
spacer -mode spaces -t 4 -r SomeCode.cs
```Then run it on some C# code like so:
```bash
csharp_2_swift -o SomeCode.swift SomeCode.cs
```Let me know how you get on!
## Development
This stuff is mostly here as a reminder to me. It really needs to go in the `Rakefile`.
### Debugging
Because of the standard Ruby directory layout, running the tools from the command line requires a little more effort:
```bash
ruby -e 'load($0=ARGV.shift);CSharp2Swift.new.execute(ARGV)' -- lib/csharp_2_swift.rb --help
```### Publishing
Here's what you need to do to publish a Ruby gem. First time only:
```bash
curl -u https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials
```Then, in the case of these tools:
```bash
gem build csharp_2_swift.gemspec
gem push csharp_2_swift-.gem
```