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
/// There is a footer color issue in the case of a plain styled (not grouped style) tableView. | |
/// Before iOS 15, the footer was colored but now it was transparent | |
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { | |
let footer = UIView() | |
footer.isUserInteractionEnabled = false | |
footer.backgroundColor = UIColor(red: 229/255, green: 229/255, blue: 229/255, alpha: 1) | |
return footer | |
} |
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
///Remove section header top spacing - https://developer.apple.com/forums/thread/684706 | |
if #available(iOS 15, *) { | |
sectionHeaderTopPadding = 0 | |
} |
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
override var preferredStatusBarStyle : UIStatusBarStyle { | |
return .default | |
} |
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
func fixiOS15AppearanceIssues() { | |
fixiOS15NavBarIssues() | |
fixiOS15TabBarIssues() | |
} | |
private func fixiOS15NavBarIssues() { | |
if #available(iOS 15, *) { | |
let appearance = UINavigationBarAppearance() | |
appearance.configureWithOpaqueBackground() | |
appearance.backgroundColor = .blue //customised nav bar background color |
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
def configure_branch_settings(target) | |
target.build_configurations.each do |config| | |
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'BRANCH_EXCLUDE_IDFA_CODE=1'] | |
end | |
end | |
post_install do |installer| | |
installer.pods_project.targets.each do |target| | |
if target.name == 'Branch' | |
# NOTE: we need to set this in order to compile Branch pod such that it won't call https://developer.apple.com/documentation/adsupport/asidentifiermanager/1614151-advertisingidentifier at runtime. This is to prevent Apple from requiring us to show https://developer.apple.com/documentation/apptrackingtransparency/attrackingmanager to users |
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
import Foundation | |
class TreeNode { | |
var data: Int | |
var left: TreeNode? | |
var right: TreeNode? | |
init(data: Int) { | |
self.data = data | |
} |
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
import Foundation | |
protocol MyNotificationCenterInterface { | |
func addObserver(_ observer: Any, selector: Selector, name: NSNotification.Name?, object: Any?) | |
func post(_ notification: Notification) | |
} | |
struct NotificationObserverData { | |
let observer: Any, | |
selector: Selector, |
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
import Foundation | |
class A { | |
func call(selector: Selector, on destination: Any) { | |
if let object = destination as? NSObject { | |
object.performSelector(onMainThread: selector, with: self, waitUntilDone: true) | |
} else { | |
DispatchQueue.main.async { | |
Thread.detachNewThreadSelector(selector, toTarget: destination, with: self) | |
} |
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
import PlaygroundSupport | |
class Node { | |
var data: Int | |
var next: Node? | |
init(data: Int) { | |
self.data = data | |
} | |
NewerOlder