This file contains hidden or 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
// Swift 3 | |
let testArray: [Double] = [15.67, 9.87, 4.56, 3.45, 3.45, 8.76, 6, 1, 20.11] | |
let average: Double = (testArray as NSArray).value(forKeyPath: "@avg.self") as! Double | |
print("Average \(average)") |
This file contains hidden or 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
@implementation TestView | |
#pragma mark - Observers | |
- (void)didMoveToWindow | |
{ | |
if (self.window) // If self.window != nil, it means view was added to the window | |
{ | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(test:) |
This file contains hidden or 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
// Swift 3 | |
import UIKit | |
class TestView: UIView { | |
// MARK: Observers | |
override func didMoveToWindow() { | |
OlderNewer