Alternative 1: Force unwrap non-optional dependencies
- No need no use any methods to unwrap on each usage, unless there are cases you anticipate a value to be nil.
var value: String!
value = "Hi"
print(value.count)
Pod::Spec.new do |s| | |
s.name = "BlaBlabla" | |
s.version = "0.1.0" | |
s.summary = "Description of your project" | |
s.description = "Mandatorily longer description of your project" | |
s.homepage = "https://github.com/ElevatedUnderdogs/PracticeCocoaPod1/tree/main" | |
s.license = "Description of your licence, name or otherwise" | |
s.author = { "Developer" => "[email protected]" } | |
s.platform = :ios, "9.0" |
import UIKit | |
public extension DateFormatter { | |
static let iso8601withFractionalSeconds: DateFormatter = { | |
let formatter = DateFormatter() | |
formatter.calendar = Calendar(identifier: .iso8601) | |
formatter.locale = Locale(identifier: "en_US_POSIX") | |
formatter.timeZone = TimeZone(secondsFromGMT: 0) | |
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" |
struct CreateAccountViewModel { | |
var image: Image | |
var accentText: String | |
var choosePathVM: ChoosePathViewModel { | |
didSet { | |
self.currentHeader = choosePathVM.current | |
self.employeeDestination = choosePathVM.current.header == HeaderBody.employee.header | |
self.authViewModel = employeeDestination ? .employeeForm : .businessForm | |
self.formModel = employeeDestination ? .employee : .business |
struct CreateAccountViewModel { | |
var image: Image = Image("IntroImage") | |
var accentText: String = "Choose Account type" | |
var choosePathVM: ChoosePathViewModel = ChoosePathViewModel(index: 0, explanations: [.employee, .business]) | |
var buttonImage: Image = Image(systemName: .rightArrowLine) | |
var spacerHeight: CGFloat = 40 | |
var currentHeader: HeaderBody { | |
get { | |
choosePathVM.current |
struct CreateAccountViewModel { | |
var image: Image = Image("IntroImage") | |
var accentText: String = "Choose Account type" | |
var choosePathVM: ChoosePathViewModel = ChoosePathViewModel(index: 0, explanations: [.employee, .business]) | |
var buttonImage: Image = Image(systemName: .rightArrowLine) | |
var spacerHeight: CGFloat = 40 | |
func sendHeader() { headerAction?(choosePathVM.current) } | |
var currentHeader: HeaderBody { choosePathVM.current } | |
var employeeDestination: Bool { choosePathVM.current.header == HeaderBody.employee.header } | |
var formModel: SignupFormViewModel { employeeDestination ? .employee : .business} |
package com.johnholdsworth.swiftbindings; | |
import com.johnholdsworth.swiftbindings.SwiftHelloTypes.TextListener; | |
import com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMap; | |
import com.johnholdsworth.swiftbindings.SwiftHelloTypes.ListenerMapList; | |
public interface SwiftHelloBinding { | |
// Messages from JavaActivity to Swift | |
public interface Listener { | |
public void setCacheDir( String cacheDir ); | |
public void processNumber( double number ); |
dependencies: [ | |
// Dependencies declare other packages that this package depends on. | |
.package(url: "https://url/of/another/package.git", from: "1.0.0"), | |
.package(path: "path/to/a/local/package/", "1.0.0"..<"2.0.0")], |
// swift-tools-version:5.3 | |
import PackageDescription | |
let package = Package( | |
name: "MyLibrary", | |
platforms: [ | |
.macOS(.v10_14), .iOS(.v13), .tvOS(.v13) | |
], | |
products: [ | |
// Products define the executables and libraries a package produces, and make them visible to other packages. |