Skip to content

NamingConventions is a library amied to help converting Name/IDs following different Naming Conventinos to each other. for example you might have a string with a given or even unknown naming-convention, and you want it to be converted to say a snake-cased-string.

License

Notifications You must be signed in to change notification settings

Acidmanic/SwiftNamingConventions

Repository files navigation

NamingConventions

Codacy Badge Build Status Version GitHub license Platform

About

NamingConventions is a library amied to help converting Name/IDs following different Naming Conventinos to each other. for example you might have a string with a given or even unknown naming-convention, and you want it to be converted to say a snake-cased-string.

Example

To use the code, you will just create an instance of ConventionConverter class, call the method: autoConvert(from:<name-id-string>,to:<destination-convention>). and the result will be your string following the destination naming convention.

	let converter = ConventionConverter()
	let convention = NamingConventions.SnakeCase
	let src = "MyFieldName"
	let result = converter.autoConvert(from: src, to: convention)
	print(src + " -> " + result)

output:

	MyFieldName -> my-field-name

NamingConvention:

You can get an object of a naming convention from the class: NamingConventions. you also can create one using its initializer (constructor) like:

 let myConvention = NamingConvention(starter: "_", firstParticle: ParticleCase.Lower, otherParticles: ParticleCase.Pretty, separator: "")
 

Requirements

This project does not have any dependencies (except for foundation!)

Installation

  • Cocoapods

NamingConventions is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'NamingConventions'
  • Carthage

To get the latest version of library using Carthage, you can add following line to your Cartfile.

github "Acidmanic/SwiftNamingConventions"

License

NamingConventions is available under the MIT license. See the LICENSE file for more info.

Thanks & Good luck 👍 Mani

About

NamingConventions is a library amied to help converting Name/IDs following different Naming Conventinos to each other. for example you might have a string with a given or even unknown naming-convention, and you want it to be converted to say a snake-cased-string.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published