https://github.com/younatics/stringfication
🔨 Make all objects to String!
https://github.com/younatics/stringfication
mirror object string swift
Last synced: 5 months ago
JSON representation
🔨 Make all objects to String!
- Host: GitHub
- URL: https://github.com/younatics/stringfication
- Owner: younatics
- License: mit
- Created: 2017-04-22T04:04:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-24T05:41:11.000Z (over 8 years ago)
- Last Synced: 2024-10-31T16:02:51.088Z (11 months ago)
- Topics: mirror, object, string, swift
- Language: Swift
- Homepage:
- Size: 121 KB
- Stars: 33
- Watchers: 7
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Stringfication
[](http://cocoapods.org/pods/Stringfication)
[](https://github.com/Carthage/Carthage)
[](https://github.com/younatics/Stringfication/blob/master/LICENSE)
[](https://travis-ci.org/younatics/Stringfication)
[](http://cocoapods.org/pods/Stringfication)
[](https://developer.apple.com/swift/)#### See [Objectification](https://github.com/younatics/Objectification) if you want to get objects where string is contained in object
## Updates
See [CHANGELOG](https://github.com/younatics/Stringfication/blob/master/CHANGELOG.md) for details## Intoduction
🔨 Make all objects to String! This library will be useful when you develop search function :)## Requirements
`Stringfication` is written in Swift 3. Compatible with iOS 8.0+
## Installation
### Cocoapods
Stringfication is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'Stringfication'
```
### Carthage
```
github "younatics/Stringfication"
```## Usage
Import `Stringfication` and inherit `Stringfication` what you want to make object to string
```swift
import Stringficationstruct Model: Stringfication {
var anyProperty: Any?
var arrayProperty: [[String]]?
var intProperty: Int?
var floatProperty: Float?
var stringProperty: String?
}
```I made some data sample in `Model`
```swift
var model = Model()
model.anyProperty = [["Developed","by","SeungyounYi"],[1,2,3]]
model.arrayProperty = [["This","is","Stringfication"],["Do","what","you","want"]]
model.intProperty = 777
model.floatProperty = 99.99
model.stringProperty = "younatics"
```Get properties
```swift
print(model.stringfication.properties())
// -> ["anyProperty", "arrayProperty", "intProperty", "floatProperty", "stringProperty"]
```Get values
```swift
print(model.stringfication.values())
// -> ["Developed", "by", "SeungyounYi", "1", "2", "3", "This", "is", "Stringfication", "Do", "what", "you", "want", "777", "99.9899979", "younatics"]
```Get all
```swift
print(model.stringfication.all())
// -> ["anyProperty", "arrayProperty", "intProperty", "floatProperty", "stringProperty", "Developed", "by", "SeungyounYi", "1", "2", "3", "This", "is", "Stringfication", "Do", "what", "you", "want", "777", "99.9899979", "younatics"]
```## References
#### Please tell me or make pull request if you use this library in your application :)## Author
[younatics 🇰🇷](http://younatics.github.io)## License
Stringfication is available under the MIT license. See the LICENSE file for more info.