React does not have computed properties out of the box like others frameworks do (Ember, Vue, etc.) so, how can we achieve this behaviour the right way ? The most common practice is to "compute" things in the render method if is a class component or just in the body if is a function component.
import UIKit | |
import UserNotifications | |
protocol PushManagerDelegate { | |
func pushManagerUpdated() | |
} | |
class PushManager: NSObject { | |
static let sharedInstance = PushManager() |
enum DateStride { | |
case year(Int) | |
case month(Int) | |
case day(Int) | |
var component: Calendar.Component { | |
switch self { | |
case .year(_): | |
return .year | |
import CloudKit | |
enum ICloudUserIDResponse { | |
case success(record: CKRecordID) | |
case failure(error: Error) | |
case notSignedIn(accountStatus: CKAccountStatus) | |
} | |
class ICloudUserIDProvider: NSObject { |
// Vectors can be inverted | |
private prefix func - (operand: CGVector) -> CGVector { | |
return CGVector(dx: -operand.dx, dy: -operand.dy) | |
} | |
// Vectors can be added and subtracted | |
private func + (lhs: CGVector, rhs: CGVector) -> CGVector { | |
return CGVector(dx: lhs.dx + rhs.dx, dy: lhs.dy + rhs.dy) | |
} | |
private func - (lhs: CGVector, rhs: CGVector) -> CGVector { |
# The trick is to link the DeviceSupport folder from the beta to the stable version. | |
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :) | |
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5: | |
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions | |
# (A similar approach works for older versions too, just change the version number after DeviceSupport) |
I am trying to determine if it is possible to build a Swift dynamic library which is itself composed of one of more private modules, without needing to expose to that fact to outside users. My hope was that I could build the private module as a static library, which would be linked into the primary (dynamic) library. The dylib
could then be deployed together with its swiftmodule
and swiftdoc
and be imported, with the private module and its symbols not being exposed at all.
Unfortunately, what I'm currently observing seems to indicate that the private module's swiftmodule
also has to be available for the primary library to be successfully imported.
This can be reproduced as follows. I have the following directory structure:
./Greeter/Logger/Logger.swift
:
public func log(_ message: String) {
let styles: [UIFont.TextStyle] = [ | |
// iOS 17 | |
.extraLargeTitle, .extraLargeTitle2, | |
// iOS 11 | |
.largeTitle, | |
// iOS 9 | |
.title1, .title2, .title3, .callout, | |
// iOS 7 | |
.headline, .subheadline, .body, .footnote, .caption1, .caption2, | |
] |
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
- Ensure any install or build dependencies are removed before the end of the layer when doing a
I have collected and moderated these ideas from various public sources and put into one place so that problem solvers and solution developers may find inspirations. Because I wish to update it regularly, I have setup as a single page wiki. You may try these ideas on hackathons/competitions/research; some are quite intense problems and some are not. Many of the problems were prepared keeping Dhaka/Bangladesh in mind, but of course can be applied to just about any underdeveloped/developing and sometimes developed countries.
- Eradicate Extreme Poverty and Hunger
- Education
- Healthcare
- Governance