Skip to content

markuspersson/SwiftUtils

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SwiftUtils

As a Java/Ruby developer coming to Swift, I found some of the core classes lacking in common functions that other languages have readily available. These classes are extensions to expand the core classes of Swift to make them easier to work with.

Also, more importantly, they're a good way to practice writing Swift.

CabForward - Austin's Leading iOS and Swift Shop - http://cabforward.com

StringUtils

  • length() -> "myString".length() ==> 8
  • substring(start: Int, length: Int) -> "myString".substring(1, length: 2) ==> "ub"
  • indexOf(searchChar: String) -> "myString".indexOf("S") ==> 2
  • replace(replaceText: String, replaceWith: String) -> "myExtraLongString".replace("ExtraLong", replaceWith: "Short") ==> "myShortString"
  • convertToCamelCase() -> "my_database_table".convertToCamelCase() ==> "MyDatabaseTable"
  • convertToUnderscoreCase() -> "MyClassName".convertToUnderscoreCase() ==> "my_class_name"

About

Utility Methods for Swift

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%