import braintree venmo in swift 4 code example
Example 1: how to use 2 alerts in swiftui
enum ActiveAlert {
case first, second
}
struct ToggleView: View {
@State private var showAlert = false
@State private var activeAlert: ActiveAlert = .first
var body: some View {
Button(action: {
if Bool.random() {
self.activeAlert = .first
} else {
self.activeAlert = .second
}
self.showAlert = true
}) {
Text("Show random alert")
}
.alert(isPresented: $showAlert) {
switch activeAlert {
case .first:
return Alert(title: Text("First Alert"), message: Text("This is the first alert"))
case .second:
return Alert(title: Text("Second Alert"), message: Text("This is the second alert"))
}
}
}
}
Example 2: How to implement Bootstrap 4 for Angular 2 ngb-pagination
<div class="container-fluid">
<div class="col-6 input-group">
<div class="col-5 input-group-addon">
<ngb-pagination [collectionSize]="users.length" #numPages [pageSize]="itemsPerPage" [(page)]="currentPage" (pageChange)="onPageChange(currentPage)"></ngb-pagination>
</div>
<div class="col-1 input-group-addon">
<input class="input-sm text-center" type="number" [min]="10" [max]="users.length" step="1" [(ngModel)]="itemsPerPage" (onClick)="changePagesize(pageSize)">
</div>
</div>
<ul *ngIf="users">
<li *ngFor="let user of users | slice: pageSize | slice: 0:itemsPerPage">
<img [src]="user.avatar" alt="{{ user.avatar }}">
<p>{{ user.id }}. {{ user.first_name }} {{ user.last_name }}</p>
</li>
</ul>
<pre><span class="float-md-left">Page: {{ currentPage }} / {{numPages.pageCount}}</span><span class="float-md-right">Found items: {{ itemsPerPage }} / {{ users.length }}</span></pre>
</div>