Created
February 15, 2018 04:50
-
-
Save LeeKahSeng/fe85b75c36fd0d2efe863bc5ddfa1d86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import CoreData | |
import UIKit | |
@objc(TestEntity) | |
public class TestEntity: NSManagedObject { | |
var image: UIImage { | |
set { | |
base64 = base64(from: image) | |
} | |
get { | |
return image(from: base64!) | |
} | |
} | |
} | |
extension TestEntity { | |
func base64(from image: UIImage) -> String { | |
// ************************************** // | |
// UIImage to base64 encoding logic here! // | |
// ************************************** // | |
return "base64-encoded-string" | |
} | |
func image(from base64: String) -> UIImage { | |
// ************************************** // | |
// base64 to UIImage decoding logic here! // | |
// ************************************** // | |
return UIImage() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment