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
struct Point { | |
let x: Int | |
let y: Int | |
} | |
extension Point { | |
init(x: Int) { | |
self.x = x | |
y = 10 | |
} |
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
struct Point { | |
let x: Int | |
let y: Int | |
init(x: Int) { | |
self.x = x | |
y = 10 | |
} | |
} |
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
struct Point { | |
let x: Int | |
let y: Int | |
} |
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
extension Array { | |
///Filter function check element isIncluded | |
func sk_Filter(isIncluded: (Element) -> Bool) -> [Element] { | |
var resultList = [Element]() | |
for element in self { | |
let isIncluded = isIncluded(element) | |
if isIncluded { | |
resultList.append(element) |
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
class ProfileViewController: UIViewController { | |
var imageView: UIImageView = { | |
let imageView = UIImageView() | |
imageView.backgroundColor = UIColor.black | |
imageView.translatesAutoresizingMaskIntoConstraints = false | |
return imageView | |
}() | |
override func viewDidLoad() { |
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
imageView.layer.masksToBounds = false | |
imageView.layer.cornerRadius = imageView.frame.height * 0.5 | |
imageView.clipsToBounds = true |
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
class ProfileViewController: UIViewController { | |
var imageView: UIImageView = { | |
let imageView = UIImageView() | |
imageView.backgroundColor = UIColor.black | |
imageView.translatesAutoresizingMaskIntoConstraints = false | |
return imageView | |
}() | |
override func viewDidLoad() { |
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
// save the message in the app A side | |
if let image = AppGroupsManager.loadImage(imageNameKey: "imageURL") { | |
imgNotification.image = image | |
} | |
// call the message at the application B side | |
AppGroupsManager.saveImage(imageData: data, imageName: "imagesName", imageNameKey: "imageURL") |
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
class AppGroupsManager: NSObject { | |
private static let groupID = "group.www.iSkyNet.demo" | |
class func saveMessage(_ message: String, key: String) { | |
let defaults = UserDefaults(suiteName: groupID) | |
defaults?.set(message, forKey: key) | |
defaults?.synchronize() | |
} | |
class func loadMessage(key: String) -> String? { |
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
// save the message in the app A side | |
let message = "iSkyNet" | |
AppGroupsManager.saveMessage(message, key: "name") | |
// call the message at the application B side | |
if let savedMessage = AppGroupsManager.loadMessage(key: "samplekey") { | |
print(savedMessage) | |
} |
NewerOlder